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

Current alpha breaks Rails 5 ActiveRecord::Sanitization#quoted_id #712

Closed
ghost opened this issue Jan 1, 2016 · 3 comments · Fixed by openfoodfoundation/openfoodnetwork#7084

Comments

@ghost
Copy link

ghost commented Jan 1, 2016

The changes to core.rb at d7ac3b0 break the quoted_id method in Rails (which, though slated for deprecation, is still used) by putting in a private quote_value method.

Originally reported at rails/rails#22847 but it's not Rails' problem.

Removing the private from acts_as_taggable_on fixes, but there may be a better fix.

@brauliobo
Copy link

got hit by this too :(

@gmcnaughton
Copy link
Contributor

I got the same error on Rails 4.2.7, after upgrading from 3.5.0 -> 4.0.0.

It happens if I pass a model to a dynamic finder method:

u = User.first
User.find_by_id(u.id) # <= #<User ...>
User.find_by_id(u)
NoMethodError: private method `quote_value' called for #<Class:0x007fd0f39a2998>
  from lib/active_record/dynamic_matchers.rb:26:in `method_missing'
  from lib/active_record/sanitization.rb:188:in `quoted_id'
  from lib/active_record/connection_adapters/abstract/quoting.rb:10:in `quote'
  from lib/active_record/statement_cache.rb:51:in `block in sql_for'
  from lib/active_record/statement_cache.rb:51:in `each'
  from lib/active_record/statement_cache.rb:51:in `sql_for'
  from lib/active_record/statement_cache.rb:105:in `execute'
  from lib/active_record/core.rb:187:in `find_by'
  from lib/active_record/dynamic_matchers.rb:70:in `find_by_id'

Passing a model instead of an id to 'find_by_id' is probably a mistake, but it is something that Rails allows!

gmcnaughton pushed a commit to curious/acts-as-taggable-on that referenced this issue Sep 25, 2016
…oted_id).

Removes use of the ActiveRecord::Sanitization#quote_value, which was
just a convenience wrapper for connection.quote. Its signature changed
in Rails 5.0.0, and it has been removed completely in Rails master.

See:
- rails/rails@268ee64
- rails/rails@12a42f7
@rogerneel
Copy link

I also got hit by this in a Rails 4.2 upgrade and can confirm that @gmcnaughton's fix is 👍 ...thanks!

Is this merge on the team's radar?

seuros added a commit that referenced this issue Dec 23, 2016
Fixes #712 (incompatibility with ActiveRecord::Sanitization#quoted_id)
tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this issue Mar 19, 2021
…oted_id).

Removes use of the ActiveRecord::Sanitization#quote_value, which was
just a convenience wrapper for connection.quote. Its signature changed
in Rails 5.0.0, and it has been removed completely in Rails master.

See:
- rails/rails@268ee64
- rails/rails@12a42f7
tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this issue Mar 19, 2021
Fixes mbleigh#712 (incompatibility with ActiveRecord::Sanitization#quoted_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants