Skip to content

Instantly share code, notes, and snippets.

@SamSamskies
Created December 12, 2013 03:28
Show Gist options
  • Save SamSamskies/7922779 to your computer and use it in GitHub Desktop.
Save SamSamskies/7922779 to your computer and use it in GitHub Desktop.
Load vars to be used in layout using Rails.
class ApplicationController < ActionController::Base
before_filter :load_vars
protected
def load_vars
#check if ajax call
unless request.xhr?
@future_events = Event.future_events.limit(15)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment