Module: SingleTableGlobalize3::ActiveRecord::ActMacro
- Defined in:
- lib/single_table_globalize3/active_record/act_macro.rb
Instance Method Summary collapse
Instance Method Details
#translates(*attr_names) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/single_table_globalize3/active_record/act_macro.rb', line 4 def translates(*attr_names) = attr_names. setup_translates!() unless translates? attr_names = attr_names.map(&:to_sym) attr_names -= translated_attribute_names if defined?(translated_attribute_names) attr_names.each do |attr_name| # Create accessors for the attribute. translated_attr_accessor(attr_name) translations_accessor(attr_name) # Add attribute to the list. self.translated_attribute_names << attr_name end end |
#translates? ⇒ Boolean
22 23 24 |
# File 'lib/single_table_globalize3/active_record/act_macro.rb', line 22 def translates? included_modules.include?(InstanceMethods) end |