Topic.record_timestamps=false | |
Topic.includes(:replies).find_each do |t| | |
last_reply = replies.sort_by(&:created_at).last | |
t.replied_at = last_reply ? last_reply.created_at : t.created_at | |
t.save | |
end |
class Whatever | |
attr_accessor :error | |
def grava_lead(attrs) | |
if some_condition | |
@error = "Some error" | |
return false | |
end | |
# ... | |
end |
Among applying the changes in the other files in this gist, you need to symlink the directory you are serving the app with in the root app's public directory so that NGINX can serve the static files in the sub-app.
For example, if you have an app at /home/coffeencoke/apps/app.coffeencoke.com/current/public
as your root app, and you have the sub app served at http://app.coffeencoke.com/admin, then you need to symlink /home/coffeencoke/apps/admin-app.coffeencoke.com/current/public
to /home/coffeencoke/apps/app.coffeencoke.com/current/public/admin
like so:
ln -s /home/coffeencoke/apps/admin-app.coffeencoke.com/current/public /home/coffeencoke/apps/app.coffeencoke.com/current/public/admin
{ | |
"files": | |
{ | |
"jquery" : "http://code.jquery.com/jquery.js", | |
"jquery.min" : "http://code.jquery.com/jquery.min.js", | |
"jquery-cookie" : "https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js", | |
"jquery-dotimeout" : "https://raw.github.com/cowboy/jquery-dotimeout/master/jquery.ba-dotimeout.min.js", | |
"jquery-extra-selectors" : "https://raw.github.com/keithclark/JQuery-Extended-Selectors/master/jquery-extra-selectors.js", | |
"jquery-flexslider" : "https://raw.github.com/mbmufffin/FlexSlider/master/jquery.flexslider-min.js", | |
"jquery-mediaelement" : "https://raw.github.com/johndyer/mediaelement/master/build/mediaelement-and-player.js", |
#!/usr/bin/env bash | |
# Usage: {script} [ OPTIONS ] TARGET VERSION | |
# | |
# TARGET Default target is "/usr/local". | |
# VERSION If not defined tries to get the build into the Sublime Text 2 website. | |
# | |
# OPTIONS | |
# | |
# -h, --help Displays this help message. | |
# |
This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.
It's a modification of the default project created with the yo keystone
generator (see https://github.com/JedWatson/generator-keystone)
Gists don't let you specify full paths, so in the project structure the files would be:
routes-index.js --> /routes/index.js // modified to add the api endpoints
routes-api-posts.js --> /routes/api/posts.js // new file containing the Post API route controllers
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
$script = <<SCRIPT | |
echo "-------------------- updating package lists" | |
apt-get update |