Skip to content

Instantly share code, notes, and snippets.

@scootcho
Forked from henrik/application_controller.rb
Last active August 29, 2015 14:20
Show Gist options
  • Save scootcho/5244e1927e75c03d9ee7 to your computer and use it in GitHub Desktop.
Save scootcho/5244e1927e75c03d9ee7 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
# stuff
private
# These groups are equivalent:
#
# render action: :new, locals: { item: x }
# render :new, locals: { item: x }
# locals :new, item: x
#
# render locals: { item: x }
# locals item: x
#
def locals(action = nil, hash)
render action: action, locals: hash
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment