-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
undefined method `caching_tag_list_on?' #432
Comments
Thanks. Would you mind also pasting the ref for the gem from your Gemfile.lock? |
|
Also Ruby engine/version, app server, how you specify acts_as_taggable in your model, and if you're using the model directly in the view or some kind of presenter. Does the stacktrace really not include the gem or the model? Try clicking 'full trace' |
Sorry. Thought this would be easy to reproduce. Ruby is 2.0.0p353 Model is just using Here's the full stack trace:
|
Thanks. (I'm just looking at the code.. haven't tried running it, yet) |
+1 having the same issue. |
I see this issue has been around in other repos, as well, spree/spree#3690 heartcombo/devise#1339 I'll try to look at it tonight. |
I believe you , but I've been unable to duplicate this, and hence, test it |
|
@seuros Thanks, done that.. still no dice.. I'm happy to accept a PR that doesn't break the tests or change behavior. |
I can mimick the notion in rails console, though, so that's something |
Try in console |
Looks like better hooks for adding methods based on the first time attributes are reflected from the database would be in https://github.com/rails/rails/blob/master/activerecord/lib/active_record/model_schema.rb#L318 Thoughts? @tenderlove @fxn @jonleighton @SamSaffron Anything is appreciated Looks like the below is only in Rails 4 # This is a hook for use by modules that need to do extra stuff to
# attributes when they are initialized. (e.g. attribute
# serialization)
def initialize_attributes(attributes, options = {}) #:nodoc:
attributes
end but Rails 3 and 4 both have this, def columns
@columns ||= connection.schema_cache.columns(table_name).map do |col|
col = col.dup
col.primary = (col.name == primary_key)
col
end
end so that we could def self.columns
@acts_as_taggable_on_columns ||= begin
db_columns = super
if hash_tag_cache_columns?
send :include, ActsAsTaggableOn::Taggable::Cache::InstanceMethods
extend ActsAsTaggableOn::Taggable::Cache::ClassMethods
class_eval do
before_save :save_cached_tag_list
end
initialize_acts_as_taggable_on_cache
end
db_columns
end
end
def self.has_tag_cache_columns?
tag_types.any? {|context| column_names.include?("cached_#{context.to_s.singularize}_list") }
end |
… column cache until db connects Specifically see, mbleigh#432 (comment)
Closing as fixed |
This isn't fixed, unfortunately. I've come across this doing a Rails 4->5 migration and have noticed something interesting. I added some logger calls to the
I'm not sure why this is the issue, but it's what I am seeing, and can repeat 100% locally. |
It may be related to calling the (missing) method on the activemodel relation (foo.last.tag_list or foo.person.tag_list) as opposed to the final object (foo.person ; foo.person.tag_list ) |
I'm seeing this as well, Rails 4 -> 5 upgrade. What I've found is after the error happens, going back to the console in development and calling Our actual usage is |
Gemfile version:
Stack Trace:
|
I made a PR to fix this (#806). Please try it and let me know if it works for you 👍 gem "acts_as_taggable_on", git: 'https://github.com/ProGM/acts-as-taggable-on.git', branch: 'fix-caching-tag-list-on-bug' |
I can confirm your PR fixes this problem. Thanks, Piero! 👍 |
… column cache until db connects Specifically see, mbleigh#432 (comment)
[mbleigh#432][mbleigh#403][mbleigh#433][mbleigh#422] Fix checking for column cache until db connects
Fix `caching_tag_list_on?` bug (mbleigh#432)
Since #403 was applied, I'm getting an error rendering a tag_list because the caching_xxx_on? method_on method has not been added. This is rails 4.0.2 working against the acts-as-taggable-on master. It seems that using base.connected? doesn't work reliably on initialization and causes errors later if these methods have not been defined.
Stacktrace is not very interesting but here it is:
The text was updated successfully, but these errors were encountered: