Skip to content

Commit

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

clears column cache on reset_column_information resolves #621
  • Loading branch information
seuros committed Jan 6, 2015
2 parents a593380 + 5697535 commit da179e8
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 da179e8

Please sign in to comment.