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

With rails 5.2, where clauses will no longer cast Class objects as Strings #20029

Conversation

jrafanie
Copy link
Member

We need to explicitly pass String objects.

Similar to #19016

Fixes errors of this variety on rails 5.2 (in a rails 5.1 backward compatible
way):

irb(main):001:0> MiqReportResult.with_chargeback
The version of PostgreSQL being connected to is incompatible with ManageIQ (10 required)
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
Traceback (most recent call last):
       16: from activerecord (5.2.4.2) lib/active_record/relation.rb:584:in `skip_query_cache_if_necessary
       ...
        1: from activerecord (5.2.4.2) lib/active_record/connection_adapters/abstract/quoting.rb:34:in `rescue in type_cast'
TypeError (can't cast Class)

…rings.

We need to explicitly pass String objects.

Similar to ManageIQ#19016

Fixes errors of this variety on rails 5.2 (in a rails 5.1 backward compatible
way):

```
irb(main):001:0> MiqReportResult.with_chargeback
The version of PostgreSQL being connected to is incompatible with ManageIQ (10 required)
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
Traceback (most recent call last):
       16: from activerecord (5.2.4.2) lib/active_record/relation.rb:584:in `skip_query_cache_if_necessary
       ...
        1: from activerecord (5.2.4.2) lib/active_record/connection_adapters/abstract/quoting.rb:34:in `rescue in type_cast'
TypeError (can't cast Class)
```
@jrafanie jrafanie requested a review from kbrock as a code owner March 30, 2020 22:02
@jrafanie
Copy link
Member Author

cc @kbrock

@miq-bot
Copy link
Member

miq-bot commented Mar 30, 2020

Checked commit jrafanie@17b0130 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@chessbyte chessbyte mentioned this pull request Mar 31, 2020
38 tasks
@kbrock kbrock merged commit 346956c into ManageIQ:master Apr 1, 2020
@jrafanie
Copy link
Member Author

jrafanie commented Apr 2, 2020

@miq-bot add_label jansa/yes?

@jrafanie jrafanie deleted the pass_strings_to_where_classes_not_class_objects branch April 2, 2020 14:53
simaishi pushed a commit that referenced this pull request Apr 3, 2020
…_not_class_objects

With rails 5.2, where clauses will no longer cast Class objects as Strings

(cherry picked from commit 346956c)
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.

5 participants