Module: Dina::MultiLingualDescription
- Defined in:
- lib/dina/utils/multi_lingual_description.rb
Instance Method Summary collapse
-
#set_multilingualDescription(opts = {}) ⇒ Object
Adds or updates a multilingualDescription with a language key.
Instance Method Details
#set_multilingualDescription(opts = {}) ⇒ Object
Adds or updates a multilingualDescription with a language key
7 8 9 10 11 12 13 14 15 |
# File 'lib/dina/utils/multi_lingual_description.rb', line 7 def set_multilingualDescription(opts = {}) if self.multilingualDescription.nil? self.multilingualDescription = opts else descriptions = multilingualDescription["descriptions"] descriptions.delete_if{|o| o["lang"] == opts.keys[0].to_s} descriptions << { "lang" => opts.keys[0].to_s, "desc" => opts[opts.keys[0]] } end end |