spec/dummy/app/contexts/language_context.rb in contexts-0.1.1 vs spec/dummy/app/contexts/language_context.rb in contexts-1.0.0
- old
+ new
@@ -1,6 +1,6 @@
-class LanguageContext < Contexts::Base
+class LanguageContext
def key
:lang
end
def required?
@@ -17,9 +17,13 @@
def current
I18n.locale
end
- def apply(ctrl, value)
- I18n.locale = value || ctrl.params[key].presence || default
+ def apply(controller, value)
+ I18n.locale = value || controller.params[key].presence || default
+ end
+
+ def url_option
+ current unless current == default
end
end