Module: Totito::ClassMethods
- Defined in:
- lib/totito/translates.rb
Instance Method Summary collapse
Instance Method Details
#translates(*attrs) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/totito/translates.rb', line 8 def translates(*attrs) attrs.each do |att| define_method att do read_attribute("#{att}_#{::I18n.locale}") || read_attribute("#{att}_#{::I18n.default_locale}") || raise('Attribute not found') end define_method "#{att}=" do raise 'You should not set directly a virtual babel fish attribute!' end end end |