Hey guys,
I have a Comment model which belongs_to a Post and a User model.
Now I want to be able to build a comment for this User and this Post.
Does it really have to go like this:
@comment = @idea.comments.build
@comment.user = current_user
Is there a better way to do this?
Thanks,
Jonas
On 2 Oct 2008, at 18:50, Jonas S. wrote:
Hey guys,
I have a Comment model which belongs_to a Post and a User model.
Now I want to be able to build a comment for this User and this Post.
Does it really have to go like this:
@comment = @idea.comments.build
@comment.user = current_user
well you can do @idea.comments.build :user => current_user
but that’s about it as far as I know (and barring dirty tricks with
with_scope)
Fred