diff --git a/app/models/post.rb b/app/models/post.rb index aea6804d3..2ed1617b5 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -48,6 +48,10 @@ class Post < ActiveRecord::Base belongs_to :o_embed_cache + after_create do + self.touch(:interacted_at) + end + #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 diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 2524cadeb..a7e0c6ee0 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -348,4 +348,13 @@ describe Post do 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