valk
valk

Reputation: 9874

Comments form can't be rendered

Rails 3 can't render the comments form for some reason, the form is:

<% form_for ([@post.eng_post, @post.eng_post.eng_comments.build]) do |f| %>

but

<%= debug @post.eng_post.eng_comments.build %>

gives

--- !ruby/object:EngComment
attributes:
  id: !!null 
  eng_post_id: 97
  full_name: !!null 
  website: !!null 
  email: !!null 
  comment: !!null 
  created_at: !!null 
  updated_at: !!null 

The models are structured as:

Posts (have one)-> EngPost (has many)-> EngComments

(More detailed models are here Rails 3, comments in a nested form, wrong routes?)

Thanks

Upvotes: 0

Views: 237

Answers (1)

Robin
Robin

Reputation: 21884

Replace <% form_for with <%= form_for

Upvotes: 3

Related Questions