Help: Should the comment.rb reside under plugins or in my app/models/comments folder?
Closed this issue · 1 comments
hariis commented
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
-name is a method I defined in user.rb
Any ideas greatly appreciated.
elight commented
As of my latest Rails 3 update, if you run the generator, you will have a Rails.root/app/models/comment.rb.