diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-01-20 12:26:30 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-02-03 16:24:01 +0000 |
commit | 7c7b008a0f2c6937b6bf02ab26134bb90aae19ee (patch) | |
tree | c8da153409eb58e4cbf6a00795b6322153cc4c03 /app/models | |
parent | 9f2db30774d159eb143497584de65f0d7a68ee40 (diff) |
Fix submission of form containing both existing and new translations
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/public_body.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index a434cce35..d3544e13c 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -64,6 +64,7 @@ class PublicBody < ActiveRecord::Base } translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme + accepts_nested_attributes_for :translations # Default fields available for importing from CSV, in the format # [field_name, 'short description of field (basic html allowed)'] @@ -151,12 +152,11 @@ class PublicBody < ActiveRecord::Base translations end - def translated_versions=(translation_attrs) + def translations_attributes=(translation_attrs) def empty_translation?(attrs) attrs_with_values = attrs.select{ |key, value| value != '' and key.to_s != 'locale' } attrs_with_values.empty? end - if translation_attrs.respond_to? :each_value # Hash => updating translation_attrs.each_value do |attrs| next if empty_translation?(attrs) |