touch interacted_at on Post#after_create
This commit is contained in:
parent
a72a09a24c
commit
a819f38b99
2 changed files with 13 additions and 0 deletions
|
|
@ -48,6 +48,10 @@ class Post < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :o_embed_cache
|
belongs_to :o_embed_cache
|
||||||
|
|
||||||
|
after_create do
|
||||||
|
self.touch(:interacted_at)
|
||||||
|
end
|
||||||
|
|
||||||
#scopes
|
#scopes
|
||||||
scope :includes_for_a_stream, includes(:o_embed_cache, {:author => :profile}, :mentions => {:person => :profile}) #note should include root and photos, but i think those are both on status_message
|
scope :includes_for_a_stream, includes(:o_embed_cache, {:author => :profile}, :mentions => {:person => :profile}) #note should include root and photos, but i think those are both on status_message
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -348,4 +348,13 @@ describe Post do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#after_create" do
|
||||||
|
it "sets #interacted_at" do
|
||||||
|
post = Factory(:status_message)
|
||||||
|
post.interacted_at.should_not be_blank
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue