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 caching on first save for an unused model #928

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kratob
Copy link

@kratob kratob commented Nov 20, 2018

On certain code paths, saving an instance of a model for the first time can cause the cache column not to be written. Affected code looks like this:

class Model < ActiveRecord::Base
  acts_as_taggable_on
end

record = Model.new
record.tag_list = 'foo, 'bar'
record.save!
record.tag_list   # => nil

The reason for this is that the after_save hook gets dynamically added when calling Model.columns. However, Model.new does not actually do that.

The fix uses Model.load_schema! instead.

@judithroth
Copy link

judithroth commented Apr 15, 2021

This would be really useful to us. Is there something that blocks merging this (apart from the conflicts that are now there because the MR is quite old)?
We would happily update the MR (or provide a new one) if there is a chance that this gets merged.

@FLeinzi
Copy link

FLeinzi commented Dec 18, 2023

Is there any chance to bring this PR up-to-date?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants