Actions
Refactor #13971
closedChange model.exists?(record) and .find(record) to use IDs
Description
Rails 4.2 contains the following deprecation:
Deprecated passing Active Record objects to .find or .exists?. Call id on the objects first.
(http://edgeguides.rubyonrails.org/4_2_release_notes.html#active-record-deprecations)
This causes:
> Domain.find(Domain.first)
2016-03-01T12:35:12 [app] [W] DEPRECATION WARNING: You are passing an instance of ActiveRecord::Base to `find`. Please pass the id of the object by calling `.id`. (called from irb_binding at (irb):1)
All instances where we pass objects into .find etc, mostly in tests, need to be changed to call .id.
This happens a lot in functional tests when a User is passed into the session object, e.g.
delete :destroy, {:id => user}, set_session_user.merge(:user => users(:admin))
causes
DEPRECATION WARNING: You are passing an instance of ActiveRecord::Base to `find`. Please pass the id of the object by calling `.id`. (called from authenticate at /home/dcleal/code/foreman/foreman/app/controllers/concerns/foreman/controller/authentication.rb:10)
Updated by The Foreman Bot almost 9 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3256 added
Updated by Dominic Cleal almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 331fcdca2550c46fbe7e451039ca6aa6a4859044.
Updated by Dominic Cleal almost 9 years ago
- Translation missing: en.field_release set to 136
Actions