I have a question about the acts_as_commentable plugin. In the instructions it says to use hidden fields to pass the model type and model id. This is somewhat confusing me. I am trying to add comments to a user object and am not sure how to specify the model type. This is the link that I am using to get the comment view where one will enter his/her comments: <%= link_to "add a comment", :action => "add", :controller => "comments", :value => @user %>
Do I pass an instance of the user object through the value=>@user above? Here is my comments add page: <% form_for( :comment, :url => comments_path ) do |f | -%> <%= f.text_field :title %> <%= f.text_field :comment %> <%= f.hidden_field 'commentable', 'commentable', :value => @user %> <%= f.hidden_field 'commentable', 'commentable_id', :value => @user.id %> <%= submit_tag 'Create' %> <% end -%>
I know this is not correct, but I am very confused as to what the @model.type and @model.id should each be. If anyone can give me a lead as to the right direction it will be much appreciated! thanks