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

Fix has_one enum where queries #25146

Merged
merged 1 commit into from May 27, 2016
Merged

Fix has_one enum where queries #25146

merged 1 commit into from May 27, 2016

Conversation

maclover7
Copy link
Contributor

Fixes #25128

if association && !association.polymorphic?
association_klass = association.klass
arel_table = association_klass.arel_table.alias(table_name)
# First check what is passed in, and see if an associationexists in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a space here: associationexists.

@sgrif sgrif self-assigned this May 26, 2016
@@ -44,17 +44,21 @@ def associated_with?(association_name)
def associated_table(table_name)
return self if table_name == arel_table.name

association = klass._reflect_on_association(table_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this entire PR could be simplified to just changing this line to

association = klass._reflect_on_association(table_name) || klass._reflect_on_association(table_name.singularize)

@maclover7 maclover7 force-pushed the fix-25128 branch 2 times, most recently from b1560d5 to a47794e Compare May 26, 2016 21:39
@maclover7
Copy link
Contributor Author

👍 updated @sgrif

if association && !association.polymorphic?
association_klass = association.klass
arel_table = association_klass.arel_table.alias(table_name)
arel_table = association_klass.arel_table.alias(table_name.to_s.pluralize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pluralize isn't needed

@maclover7
Copy link
Contributor Author

👍 updated again @sgrif :)

@sgrif sgrif merged commit 0a571e4 into rails:master May 27, 2016
@maclover7 maclover7 deleted the fix-25128 branch May 27, 2016 00:16
@maclover7
Copy link
Contributor Author

👍

kamipo pushed a commit to kamipo/rails that referenced this pull request Jul 28, 2016
Fix `has_one` `enum` `where` queries
rafaelfranca added a commit that referenced this pull request Jul 28, 2016
NickLaMuro added a commit to NickLaMuro/manageiq that referenced this pull request Jan 9, 2017
In the following:

rails/rails#25146

Rails added a regression to making nested joins with references to those
joins in the WHERE clause, and this causes an error when running this
test suite in Rails 5.0.1.

This has been addressed in Rails with:

rails/rails#27598

And has been merged into master, but it is likely that Rails 5.0.1 will
not be pulled from Rubygems, and the ManageIQ will fail to run tests
properly with that version of Rails.

Because of that, and to allow the tests to function in the same way, the
simplest thing to do is to stringify the keys manually avoid the error
for now.  This is against the convention (most Rails devs prefer
symbols), but this allows the tests to remain as they were.
chrisarcand pushed a commit to chrisarcand/manageiq that referenced this pull request Jan 9, 2017
In the following:

rails/rails#25146

Rails added a regression to making nested joins with references to those
joins in the WHERE clause, and this causes an error when running this
test suite in Rails 5.0.1.

This has been addressed in Rails with:

rails/rails#27598

And has been merged into master, but it is likely that Rails 5.0.1 will
not be pulled from Rubygems, and the ManageIQ will fail to run tests
properly with that version of Rails.

Because of that, and to allow the tests to function in the same way, the
simplest thing to do is to stringify the keys manually avoid the error
for now.  This is against the convention (most Rails devs prefer
symbols), but this allows the tests to remain as they were.
agrare pushed a commit to ManageIQ/inventory_refresh that referenced this pull request Aug 28, 2018
In the following:

rails/rails#25146

Rails added a regression to making nested joins with references to those
joins in the WHERE clause, and this causes an error when running this
test suite in Rails 5.0.1.

This has been addressed in Rails with:

rails/rails#27598

And has been merged into master, but it is likely that Rails 5.0.1 will
not be pulled from Rubygems, and the ManageIQ will fail to run tests
properly with that version of Rails.

Because of that, and to allow the tests to function in the same way, the
simplest thing to do is to stringify the keys manually avoid the error
for now.  This is against the convention (most Rails devs prefer
symbols), but this allows the tests to remain as they were.

(transferred from ManageIQ/manageiq@4e96ee4)
agrare pushed a commit to ManageIQ/inventory_refresh that referenced this pull request Sep 5, 2018
In the following:

rails/rails#25146

Rails added a regression to making nested joins with references to those
joins in the WHERE clause, and this causes an error when running this
test suite in Rails 5.0.1.

This has been addressed in Rails with:

rails/rails#27598

And has been merged into master, but it is likely that Rails 5.0.1 will
not be pulled from Rubygems, and the ManageIQ will fail to run tests
properly with that version of Rails.

Because of that, and to allow the tests to function in the same way, the
simplest thing to do is to stringify the keys manually avoid the error
for now.  This is against the convention (most Rails devs prefer
symbols), but this allows the tests to remain as they were.


(transferred from ManageIQ/manageiq@4e96ee4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants