Module: Mongoid::I18n::ClassMethods

Defined in:
lib/mongoid/i18n.rb

Instance Method Summary collapse

Instance Method Details

#localized_field(name, options = {}) ⇒ Object



13
14
15
# File 'lib/mongoid/i18n.rb', line 13

def localized_field(name, options = {})
  field name, options.merge(:type => LocalizedField, :default => {})
end

#validates_all_locales(names, options = {}) ⇒ Object



25
26
27
# File 'lib/mongoid/i18n.rb', line 25

def validates_all_locales(names, options = {})
  validates_with LocalizedValidator, options.merge(:mode => :all_locales,  :attributes => names)
end

#validates_default_locale(names, options = {}) ⇒ Object



17
18
19
# File 'lib/mongoid/i18n.rb', line 17

def validates_default_locale(names, options = {})
  validates_with LocalizedValidator, options.merge(:mode => :only_default, :attributes => names)
end

#validates_one_locale(names, options = {}) ⇒ Object



21
22
23
# File 'lib/mongoid/i18n.rb', line 21

def validates_one_locale(names, options = {})
  validates_with LocalizedValidator, options.merge(:mode => :one_locale,   :attributes => names)
end