Skip to content

Commit

Permalink
Ensure that caching_tag_list_on? is injected before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
ProGM committed Feb 20, 2017
1 parent 73d5f90 commit 4757ae5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/acts_as_taggable_on/taggable/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def tag_list_cache_on(context)
variable_name = "@#{context.to_s.singularize}_list"
if instance_variable_get(variable_name)
instance_variable_get(variable_name)
elsif cached_tag_list_on(context) && self.class.caching_tag_list_on?(context)
elsif cached_tag_list_on(context) && ensure_included_cache_methods! && self.class.caching_tag_list_on?(context)
instance_variable_set(variable_name, ActsAsTaggableOn.default_parser.new(cached_tag_list_on(context)).parse)
else
instance_variable_set(variable_name, ActsAsTaggableOn::TagList.new(tags_on(context).map(&:name)))
Expand Down Expand Up @@ -418,6 +418,10 @@ def save_tags

private

def ensure_included_cache_methods!
self.class.columns
end

# Filters the tag lists from the attribute names.
def attributes_for_update(attribute_names)
tag_lists = tag_types.map {|tags_type| "#{tags_type.to_s.singularize}_list"}
Expand Down

0 comments on commit 4757ae5

Please sign in to comment.