This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var facebook_tools = new function() { | |
this.init = function () { | |
if (FB.getSession() == null) { | |
this.login(); | |
} else { | |
facebook_session = FB.getSession(); | |
} | |
return this; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project < ActiveRecord::Base | |
def next | |
self.class.where("created_at > ?", self.created_at).order("created_at asc").first | |
end | |
def previous | |
self.class.where("created_at < ?", self.created_at).order("created_at desc").first | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProjectsController < ApplicationController | |
before_filter :get_base_project, :only => [:next,:previous] | |
before_filter :force_js_content_type, :only => [:next,:previous] | |
caches_action :next, :cache_path => proc{ |c| "/projects/" + (c.get_base_project.next.cache_key rescue "nil")}, :expires_in => 15.minutes | |
caches_action :previous, :cache_path => proc{ |c| "/projects/" + (c.get_base_project.previous.cache_key rescue "nil")}, :expires_in => 15.minutes | |
def next | |
@project = @base_project.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/projects/:base_project_id/next', :to => 'projects#next', :as => :next_project | |
get '/projects/:base_project_id/previous', :to => 'projects#previous', :as => :previous_project |