-
Notifications
You must be signed in to change notification settings - Fork 896
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
Replace class objects in query values with strings to fix a rails 5.0 deprecation #18827
Merged
bdunne
merged 1 commit into
ManageIQ:master
from
jrafanie:fix_passing_a_class_as_a_value_in_an_active_record_query_deprecation
May 31, 2019
Merged
Replace class objects in query values with strings to fix a rails 5.0 deprecation #18827
bdunne
merged 1 commit into
ManageIQ:master
from
jrafanie:fix_passing_a_class_as_a_value_in_an_active_record_query_deprecation
May 31, 2019
Conversation
This file contains 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
@bdunne 🍰 🍪 |
jrafanie
commented
May 30, 2019
:active => { | ||
:class_name => MiqProvision.name, :ids => [], :storage_by_id => Hash.new { |k, v| k[v] = 0 }, | ||
:class_name => "MiqProvision", :ids => [], :storage_by_id => Hash.new { |k, v| k[v] = 0 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bonus change that doesn't raise the deprecation but prevents autoload here and the above two places.
jrafanie
added a commit
to jrafanie/manageiq
that referenced
this pull request
May 30, 2019
Fixes: DEPRECATION WARNING: Passing a class as a value in an Active Record query is deprecated and will be removed. Pass a string instead. (called from block in <class:ExtManagementSystem> at /Users/joerafaniello/Code/manageiq/app/models/ext_management_system.rb:107) Similar to ManageIQ#18827
Fixes the following on rails 5.0: DEPRECATION WARNING: Passing a class as a value in an Active Record query is deprecated and will be removed. Pass a string instead. (called from put_or_update at /var/www/miq/vmdb/app/models/miq_queue.rb:343) In rails 5.1, you get this if you try using a class object: > MiqQueue.where(:class_name => MiqServer) TypeError (can't cast Class)
jrafanie
force-pushed
the
fix_passing_a_class_as_a_value_in_an_active_record_query_deprecation
branch
from
May 30, 2019 21:53
06b63a6
to
6ed429d
Compare
Checked commit jrafanie@6ed429d with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
mzazrivec
added a commit
to mzazrivec/manageiq-ui-classic
that referenced
this pull request
May 31, 2019
This is to reflect changes in ManageIQ/manageiq#18827
This was referenced May 31, 2019
jrafanie
added a commit
to jrafanie/manageiq
that referenced
this pull request
May 31, 2019
Fixes: DEPRECATION WARNING: Passing a class as a value in an Active Record query is deprecated and will be removed. Pass a string instead. (called from block in <class:ExtManagementSystem> at /Users/joerafaniello/Code/manageiq/app/models/ext_management_system.rb:107) Similar to ManageIQ#18827
jrafanie
added a commit
to jrafanie/manageiq
that referenced
this pull request
May 31, 2019
Rails 5.1 dropped support for query values of type Class, and we should have fixed most of them with ManageIQ#18827 and ManageIQ#18829, but since detecting callers to put_or_update that do this could be difficult, we can still support this by "fixing" it so rails 5.1 doesn't raise an exception, and give us time to fix the caller.
thearifismail
pushed a commit
to thearifismail/manageiq
that referenced
this pull request
Jun 3, 2019
Fixes: DEPRECATION WARNING: Passing a class as a value in an Active Record query is deprecated and will be removed. Pass a string instead. (called from block in <class:ExtManagementSystem> at /Users/joerafaniello/Code/manageiq/app/models/ext_management_system.rb:107) Similar to ManageIQ#18827
thearifismail
pushed a commit
to thearifismail/manageiq
that referenced
this pull request
Jun 3, 2019
Rails 5.1 dropped support for query values of type Class, and we should have fixed most of them with ManageIQ#18827 and ManageIQ#18829, but since detecting callers to put_or_update that do this could be difficult, we can still support this by "fixing" it so rails 5.1 doesn't raise an exception, and give us time to fix the caller.
jrafanie
deleted the
fix_passing_a_class_as_a_value_in_an_active_record_query_deprecation
branch
October 4, 2019 19:46
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 the following on rails 5.0:
In rails 5.1, you get this if you try using a class object:
Note, these were picked up in the QE test suite.