alphagov/whitehall — pull request #45 by chrismdp (2012-10-05 12:48:06+00:00)
Title: Attachments now store price on edition edit

The issue is that price is a local member variable, not an ActiveRecord
attribute. This means that the attachment validations weren't being run
when saving an existing edition, as Rails appears to skip validations
for associated objects on edit if there are no attribute changes.

The fix is to update the attribute at the point we change the price,
rather than on a before_save.

Would be grateful for feedback. Test isn't the greatest, but we have to
exercise Rails in order to properly test the workaround.