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

Display invalid value in error #44255

Merged

Conversation

justin808
Copy link
Contributor

Summary

Upon upgrading a Rails 6.1 to Rails 7 application, we saw errors like:

ActionView::Template::Error
The :mode option must be one of [:all, :n_plus_one_only].

Showing the invalid value is more informative.

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>
@rafaelfranca rafaelfranca merged commit efae65d into rails:main Jan 27, 2022
public-rant pushed a commit to opensource-rant/rails that referenced this pull request Feb 17, 2022
* Display invalid value in error

* Update activerecord/lib/active_record/core.rb

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>
@rsilva4-zz
Copy link

rsilva4-zz commented Mar 30, 2022

@justin808 was this issue originally related to caching by any chance? If you could elaborate a bit more would be nice since I'm experiencing a similar problem atm.

In my case, we found out that the serialised objects in the cache did not have the mentioned :mode hence the issue. We solved this by disabling the cache during the transition from Rails 6 to 7.

@natematykiewicz
Copy link
Contributor

natematykiewicz commented Sep 7, 2022

@rsilva4 Thanks for this comment! I had the exact same problem just now and Rails.cache.clear fixed it. We must have some ActiveRecord objects being cached and so the :mode was nil (as you said).

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

4 participants