Module: SimpleModelTranslations::Attributes

Defined in:
lib/simple_model_translations/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attributes=(attributes) ⇒ Object



3
4
5
6
7
# File 'lib/simple_model_translations/attributes.rb', line 3

def attributes=(attributes)
  I18n.with_locale(attributes.delete(:locale) || translation_helper.current_locale_for_translation) do
    super(attributes)
  end
end

#update_attributes(attributes) ⇒ Object



15
16
17
18
19
# File 'lib/simple_model_translations/attributes.rb', line 15

def update_attributes(attributes)
  I18n.with_locale(attributes.delete(:locale) || translation_helper.current_locale_for_translation) do
    super(attributes)
  end
end

#update_attributes!(attributes) ⇒ Object



9
10
11
12
13
# File 'lib/simple_model_translations/attributes.rb', line 9

def update_attributes!(attributes)
  I18n.with_locale(attributes.delete(:locale) || translation_helper.current_locale_for_translation) do
    super(attributes)
  end
end