Skip to content

Commit

Permalink
Deprecate PublicBody#translations_attributes=(Array)
Browse files Browse the repository at this point in the history
Array handling will no longer be supported in release 0.22
  • Loading branch information
garethrees committed Jan 22, 2015
1 parent c78e50b commit 9babbb4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/public_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ def empty_translation?(attrs)
t.save!
end
else # Array => creating
warn "[DEPRECATION] PublicBody#translations_attributes= " \
"will no longer accept an Array as of release 0.22. " \
"Use Hash arguments instead. See " \
"spec/models/public_body_spec.rb for more details"

translation_attrs.each do |attrs|
next if empty_translation?(attrs)
new_translation = PublicBody::Translation.new(attrs)
Expand Down

1 comment on commit 9babbb4

@crowbot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be helpful to also point people at the new form - presumably the case where this would affect them would be where they created their own custom admin templates from ours and now need to update them. Given that I changed this method name, we should also leave a wrapper with the old method name. We also should clean up (not in this hotfix but before we make the next release) the other places where this pattern has been replicated - in the forms for PublicBodyHeadings and PublicBodyCategories. I've ticketed that here.

Please sign in to comment.