Module: Mongoid::Localized::Accessor
- Defined in:
- lib/mongoid-localized-accessor.rb,
lib/mongoid-localized-accessor/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mongoid-localized-accessor.rb', line 6 def method_missing method if (org = method.to_s.split(/_\w\w$/)).length == 2 if self.respond_to? org[0].to_sym if self.try(:[],org[0].to_sym) self.try(:[],org[0].to_sym).try(:[],org[1]) else if self.try(org[0].to_sym) self.try(org[0].to_sym).try(:[],org[1]) end end else super end else super end end |