diff --git a/app/models/user.rb b/app/models/user.rb index 7ab2987d9..297a2d9c8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -44,7 +44,11 @@ class User post = model_class.instantiate(options) post.creator_signature = post.sign_with_key(encryption_key) post.notify_people - post.socket_to_uid owner.id if (owner_id && post.respond_to?( :socket_to_uid)) + post.socket_to_uid owner.id if (owner_id && post.respond_to?(:socket_to_uid)) + + self.posts << post + self.save + post end ######### Posts and Such ############### diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e0d2415c7..621e0ad5d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -283,6 +283,12 @@ describe User do @user.posts.count.should == 0 end + + it "should add the post to that user's posts when a user posts it" do + status_message = @user.post :status_message, :message => "hi" + @user.reload + @user.posts.include?(status_message).should be true + end it 'should be removed on unfriending' do status_message = @user2.post :status_message, :message => "hi"