Rails comments gem Acts_as_commentable on pins -
I have a rail app where users can upload the PIN, I [works_as_commentable_gem] [1] / code > To allow users to comment on the PIN, here is my configuration:
App / Model / PinRB
class PIN & Lt; ActiveRecord :: Base acts_ass_cableable
app / controllers / pin_controllerRbb
die show @ pin.fand param [id ] & Lt;% = form_tag "/ pins / add_new_comment"%> & Lt;% = hidden_field_tag "id", post.id% & gt; & Lt;% = text_area_tag "comment [comment]"%> & Lt;% = submit_tag "Pin Comment"% & gt; & Lt;% end% & gt;
App / Model / Comment RB
class comment & lt; ActiveRecord :: Base includes the works Am Commemeneble :: Comment related_to: commentable, polymorphic = & gt; Correct default_scope - & gt; {Order ('created_at ASC')} Note: If you want to vote on the quality of # comments, then install the works_as_votable plugin. #acts_as_voteable # Note: Comments related to a user: user end
app / controller / pin_controler.rb
def Add_new_comment pin = pin.find (param [: id]) pins & lt; & Lt; Pin.new (param [[comment]) redirect_to: action => : Show ,: ID = & gt; Pin end
Finally my config / roots
get "/ pin / add_new_comment" = & gt; "Pin # add_nu_cutant" ,: like = & gt; "Add_new_comment_to_pins" ,: by = & gt; [: Pin]
But I go to a routing error:
Undefined local variable or method `act_as_commentable 'for pcccontroller: Class
I'm sure where this error comes from, any thoughts?
I'm not really sure but you should not be the path
Get "/ pins /: id / add_new_comment" = & gt; "Pin # add_nu_cutant" ,: like = & gt; "Add_new_comment_to_pins"
Comments
Post a Comment