Skip to content

Instantly share code, notes, and snippets.

@brunoandradd
Created January 14, 2015 13:42
Show Gist options
  • Save brunoandradd/6f5fe47b92d66df40aae to your computer and use it in GitHub Desktop.
Save brunoandradd/6f5fe47b92d66df40aae to your computer and use it in GitHub Desktop.
helper_method_example.rb
class ApplicationController < ActionController::Base
protect_from_forgery with: :null_session
before_action :set_locale
before_filter :authenticate_user!
self.responder = AppResponder
respond_to :html
helper_method :current_salon
def current_salon
current_user.userable
end
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
def default_url_options(options={})
{ :locale => I18n.locale }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment