Fix deprecation: pass id instead of object to .exists?#219
Merged
Conversation
Fixes the following Rails 4.2 deprecation warning:
DEPRECATION WARNING: You are passing an instance of ActiveRecord::Base to `exists?`. Please pass the id of the object by calling `.id`.
See: https://guides.rubyonrails.org/4_2_release_notes.html#active-record-deprecations
Merged
tom93
added a commit
that referenced
this pull request
Dec 28, 2023
Steps: * Update Gemfile * bundle update --conservative rails actionpack railties activerecord activemodel activesupport rack responders Also add an explicit dependency on responders, because Rails 4.2 moved the `respond_with` method out to a separate gem[1]. (We're currently okay because devise depends on responders, but seeing how we're explicitly using the `respond_with` method we should add an explicit dependency.) There are lots of warnings & deprecations, but nothing is _failing_ in the test suite. The deprecation warnings will be fixed separately (e.g. #219, #220). Note that due to a change in Rack, `rails server` now listens on `localhost` instead of `0.0.0.0` by default in development mode[2][3]. This prevents connections from other machines for security. The older behaviour can be achieved using `rails server -b 0.0.0.0`. (Also, when using `rails server` without `-b`, note that `localhost` may resolve to an IPv6 address depending on the operating system, in which case http://127.0.0.1:3000 won't work; instead, use http://localhost:3000.) [1] https://guides.rubyonrails.org/4_2_release_notes.html#respond-with-class-level-respond-to [2] https://guides.rubyonrails.org/4_2_release_notes.html#default-host-for-rails-server [3] rack/rack@28b0144 Co-authored-by: Tom Levy <tomlevy93@gmail.com>
bagedevimo
approved these changes
Dec 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes some deprecation warnings from Rails 4.2 update (#199).
Not fully tested (only checked that the tests pass).
From the commit message: