Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

considering non-modified attributes as modified when object retrieved as a part of collection #404

Closed
sashazykov opened this issue May 9, 2016 · 1 comment

Comments

@sashazykov
Copy link

It tries to save non-modified attributes when send_only_modified_attributes is true:

[1] pry(main)> drivers = Driver.where('filter[user_id]' => 1)
=> #<Her::Model::Relation:0x007fc4f5a8ed48 @_fetch=nil, @params={"filter[user_id]"=>1}, @parent=Driver>
[2] pry(main)> d = drivers.first
=> #<Driver(drivers/40) created_at="2015-01-18T11:28:14.944Z" updated_at="2016-05-06T07:21:12.443Z" phone="+39393939" user_id=1 id="40">
[3] pry(main)> d.phone = "+7777"
=> "+7777"
[5] pry(main)> d.changes
=> {"created_at"=>[nil, "2015-01-18T11:28:14.944Z"], "updated_at"=>[nil, "2016-05-06T07:21:12.443Z"], "phone"=>[nil, "+7777"], "user_id"=>[nil, 1]}
[6] pry(main)> d.save
=> false
[7] pry(main)> d.response_errors
=> [{:title=>"Param not allowed", :detail=>"created_at is not allowed.", :id=>nil, :href=>nil, :code=>105, :source=>nil, :links=>nil, :status=>"400", :meta=>nil},
 {:title=>"Param not allowed", :detail=>"updated_at is not allowed.", :id=>nil, :href=>nil, :code=>105, :source=>nil, :links=>nil, :status=>"400", :meta=>nil}]
@zacharywelch
Copy link
Collaborator

Fixed by #298

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants