Module: Globalize::ActiveRecord::ActMacro

Defined in:
lib/globalize/active_record/act_macro.rb

Instance Method Summary collapse

Instance Method Details

#class_nameObject



17
18
19
20
21
22
# File 'lib/globalize/active_record/act_macro.rb', line 17

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
15
# File 'lib/globalize/active_record/act_macro.rb', line 4

def translates(*attr_names)
  options = attr_names.extract_options!
  # Bypass setup_translates! if the initial bootstrapping is done already.
  setup_translates!(options) unless translates?
  check_columns!(attr_names)

  # 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



24
25
26
# File 'lib/globalize/active_record/act_macro.rb', line 24

def translates?
  included_modules.include?(InstanceMethods)
end