Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Comments

Render Partial

  • Please log in to reply
1 reply to this topic

#1 vikhyat620

vikhyat620

    Passenger

  • Members
  • 9 posts

Posted 11 May 2014 - 11:51 AM

I am trying to add comments to my post, so i crated a a new scaffold for it

i set it to belongs_to :posts

              belongs_to :comments

 

Post.rb:

has_many :comments

I made a field called post_id, but didnt define it in the controller.

In my posts.show.html.erb, i added

<%= render "comments/form" %>

Which worked perfectly and added a small comments form, but im unable to submit a comment.

 

I even added:

<%= render @post.comments.all %>



#2 th3mus1cman

th3mus1cman

    Signalman

  • Members
  • 14 posts
  • LocationRichmond, VA

Posted 04 June 2014 - 05:38 PM

Need more information. Can you post the model, view and controller code related to this?


Rails Developer and Partner at Left + Right






Also tagged with one or more of these keywords: Render, Partial

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users