added :dependent => :destroy to is_impressionable
This commit is contained in:
parent
f396b056f5
commit
7a113edeb2
|
@ -11,7 +11,7 @@ module Impressionist
|
||||||
@cache_options = nil
|
@cache_options = nil
|
||||||
|
|
||||||
def is_impressionable(options={})
|
def is_impressionable(options={})
|
||||||
has_many :impressions, :as=>:impressionable
|
has_many :impressions, :as => :impressionable, :dependent => :destroy
|
||||||
@cache_options = options[:counter_cache]
|
@cache_options = options[:counter_cache]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
PATH
|
PATH
|
||||||
remote: /Users/coryschires/Desktop/work/applications/impressionist
|
remote: /home/mio/prog/projects/impressionist
|
||||||
specs:
|
specs:
|
||||||
impressionist (0.4.0)
|
impressionist (1.0.1)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
ZenTest (4.6.2)
|
|
||||||
actionmailer (3.1.0)
|
actionmailer (3.1.0)
|
||||||
actionpack (= 3.1.0)
|
actionpack (= 3.1.0)
|
||||||
mail (~> 2.3.0)
|
mail (~> 2.3.0)
|
||||||
|
@ -38,8 +37,6 @@ GEM
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
addressable (2.2.6)
|
addressable (2.2.6)
|
||||||
arel (2.2.1)
|
arel (2.2.1)
|
||||||
autotest (4.4.6)
|
|
||||||
ZenTest (>= 4.4.1)
|
|
||||||
autotest-notification (2.3.3)
|
autotest-notification (2.3.3)
|
||||||
autotest-standalone (~> 4.5)
|
autotest-standalone (~> 4.5)
|
||||||
autotest-standalone (4.5.8)
|
autotest-standalone (4.5.8)
|
||||||
|
@ -158,8 +155,6 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
ZenTest
|
|
||||||
autotest
|
|
||||||
autotest-notification
|
autotest-notification
|
||||||
capybara
|
capybara
|
||||||
cucumber
|
cucumber
|
||||||
|
|
|
@ -49,7 +49,15 @@ describe Impression do
|
||||||
@article.impressionist_count(:filter=>:session_hash).should eq 7
|
@article.impressionist_count(:filter=>:session_hash).should eq 7
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# tests :dependent => :destroy
|
||||||
|
it "should delete impressions on deletion of impressionable" do
|
||||||
|
impressions_count = Impression.all.size
|
||||||
|
a = Article.create
|
||||||
|
i = a.impressions.create
|
||||||
|
a.destroy
|
||||||
|
a.destroyed?.should be_true
|
||||||
|
i.destroyed?.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
#OLD COUNT METHODS. DEPRECATE SOON
|
#OLD COUNT METHODS. DEPRECATE SOON
|
||||||
it "should return the impression count with no date range specified" do
|
it "should return the impression count with no date range specified" do
|
||||||
|
|
Loading…
Reference in New Issue