Reputation: 41
I'm stuck, trying to create form_for for my comments model. I try to get post_id and user_id through locales, pass them to the form and create text_field for comment text. After that I'm getting "no implicit conversion of Symbol into Integer" error. My code:
<%= render partial: 'comments/form', locals: {user_id: current_user.id, post_id: post.id} %>
<%= form_for @comment, user_post_comments(user_id: user_id, post_id: post_id) do |f| %>
<% f.text_field :text %>
<% end %>
Upvotes: 1
Views: 1265
Reputation: 41
The mistake was in route. The correct version:
<%= form_for @comment, url:user_post_comments(user_id: user_id, post_id: post_id) do |f| %>
Upvotes: 3