This method is executed when a named scope is being resolved. It will check if this scope is the locale() scope, and if so, will set all the necessary for the actual locale filter be applied
# File vendor/plugins/ubiquo_i18n/lib/ubiquo_i18n/extensions/named_scope.rb, line 12
12: def method_missing_with_locale_scope(method, *args, &block)
13: if proxy_options[:locale_scoped] && proxy_options[:locale_list]
14: # this is a locale() call
15: # find the model we are acting on
16: klass = proxy_scope
17: while !(Class === klass)
18: if klass.respond_to?(:proxy_scope)
19: klass = klass.proxy_scope
20: elsif klass.is_a?(Array)
21: klass = klass.first.class
22: end
23: end
24: # tell the (adequate) model that we are heading there
25: if klass.respond_to?(:really_translatable_class)
26: klass = klass.really_translatable_class
27: unless klass.instance_variable_get(:@setting_locale_list)
28: klass.instance_variable_set(:@locale_scoped, true)
29: current_locale_list = klass.instance_variable_get(:@current_locale_list)
30: (current_locale_list ||= []) << proxy_options[:locale_list]
31: klass.instance_variable_set(:@current_locale_list, current_locale_list)
32: end
33: begin
34: # avoid coming here a second time to reset the current_locale_list
35: klass.instance_variable_set(:@setting_locale_list, true)
36: return method_missing_without_locale_scope(method, *args, &block)
37: ensure
38: klass.instance_variable_set(:@setting_locale_list, false)
39: end
40: end
41: end
42: method_missing_without_locale_scope(method, *args, &block)
43: end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.