Module: ZLocalize::Translatable::TranslatedColumns::ClassMethods

Defined in:
lib/zlocalize/rails/translated_columns.rb

Instance Method Summary collapse

Instance Method Details

#translates_columns(*column_names) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/zlocalize/rails/translated_columns.rb', line 39

def translates_columns(*column_names)

  [column_names].flatten.each do |col_name|
    class_eval "def #{col_name}(options = {})
                  read_translated_column('#{col_name}',(options[:locale] || ZLocalize.locale),options[:fetch_default] == true)
                end"
  end

  include ZLocalize::Translatable::TranslatedColumns::InstanceMethods
end