Module: Globalize::ActiveRecord::ActMacro
- Defined in:
- lib/globalize/active_record/act_macro.rb
Instance Method Summary collapse
Instance Method Details
#class_name ⇒ Object
16 17 18 19 20 21 |
# File 'lib/globalize/active_record/act_macro.rb', line 16 def class_name @class_name ||= begin class_name = table_name[table_name_prefix.length..-(table_name_suffix.length + 1)].downcase.camelize pluralize_table_names ? class_name.singularize : class_name end end |
#translates(*attr_names) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/globalize/active_record/act_macro.rb', line 4 def translates(*attr_names) = attr_names. # Bypass setup_translates! if the initial bootstrapping is done already. setup_translates!() unless translates? # Add any extra translatable attributes. attr_names = attr_names.map(&:to_sym) attr_names -= translated_attribute_names if defined?(translated_attribute_names) allow_translation_of_attributes(attr_names) if attr_names.present? end |
#translates? ⇒ Boolean
23 24 25 |
# File 'lib/globalize/active_record/act_macro.rb', line 23 def translates? included_modules.include?(InstanceMethods) end |