Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request mbleigh#622 from fatfreecrm/fix/clear_column_cache…
Browse files Browse the repository at this point in the history
…_on_reset_column_information

clears column cache on reset_column_information resolves mbleigh#621
  • Loading branch information
seuros committed Jan 6, 2015
2 parents 5fa1213 + c4c8fb7 commit 969bd42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/acts_as_taggable_on/taggable/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def columns
end
end

def reset_column_information
super
@acts_as_taggable_on_cache_columns = nil
end
end
end

Expand Down
6 changes: 6 additions & 0 deletions spec/acts_as_taggable_on/caching_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
@taggable.save!
expect(@taggable.tag_list.sort).to eq(%w(awesome epic).sort)
end

it 'should clear the cache on reset_column_information' do
CachedModel.column_names
CachedModel.reset_column_information
expect(CachedModel.instance_variable_get(:@acts_as_taggable_on_cache_columns)).to eql(nil)
end
end

describe 'CachingWithArray' do
Expand Down

0 comments on commit 969bd42

Please sign in to comment.