I am trying to use the new partial_updates feature in rails 2.1, http://dev.rubyonrails.org/changeset/9157 but it is failing by trying to use all validations in the model instead of just the changed attributes. The model works as I can successfully .save(false) but if I try a regular .save I get an error saying that it could not save because of validations problems. I want to use this to get around the challenges of saving a part of a wide table without resorting to the validation_scenarios plugin.
Any ideas on how I can fix this?
Black-Mac:turbocis89 Charles$ script/console Loading development environment (Rails 2.0.991)
Spec.partial_updates
=> true
User.partial_updates
=> true
@user = User.find_by_screen_name('vince888')
=> #<User id: 1, screen_name: "vince888", password: "vince888", email: "vince@vince888.com", created_at: "2008-05-15 12:35:12", updated_at: "2008-05-15 13:03:38", authorization_token: nil>
@user.spec.city_of_birth
=> "Wichita"
@user.spec.city_of_birth = 'Charleston'
=> "Charleston"
@user.spec.changes
=> {"city_of_birth"=>["Wichita", "Charleston"]}
@user.spec.save
=> false ### in the application this is failing because of other unrelated attributes not passing validations.
@user.spec.save(false)
=> true
@user.spec.changes
=> {}
@user.spec.city_of_birth
=> "Charleston"