views:

15

answers:

0

In the plugin or should I move this to my app/models/comments folder ? or Does it even matter?

The reason I ask is, the belongs_to :user association does not seem to work when I do this

comments_controller:

@comment = Comment.build_from(@post, @user.id, comment_body)
@comment.save

the comment record is created properly in DB

In my view _comment.html.erb, the following chokes

<%= comment.user.name %>

Throws exception undefined method `name' for "#<User:0xb590f7e4>":User

Note: name is a method I defined in user.rb

This happens even if I do this in controller:

@comment = Comment.find(params[:id])

However, while displaying comments, it works

<%= render :partial => "/comments/comment", :collection => @post.root_comments, :inline => true %>

Any ideas/clues as to what I am missing greatly appreciated.

Thanks

P.S Can someone create the tag acts_as_commentable_with_threading?