Module: RailsCom::ControllerHelper
- Defined in:
- lib/rails_com/helpers/controller_helper.rb
Instance Method Summary collapse
Instance Method Details
#detect_filter(filter) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rails_com/helpers/controller_helper.rb', line 11 def detect_filter(filter) callback = self.__callbacks[:process_action].find { |i| i.filter == filter.to_sym } return false unless callback _if = callback.instance_variable_get(:@if).map do |c| c.call(self) end _unless = callback.instance_variable_get(:@unless).map do |c| !c.call(self) end !(_if + _unless).uniq.include?(false) end |
#set_locale ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/rails_com/helpers/controller_helper.rb', line 3 def set_locale if params[:locale] session[:locale] = params[:locale] end I18n.locale = session[:locale] || I18n.default_locale end |