comments won't save
Closed this issue · 1 comments
This is my view
<%= form_for (:comment), :url => "#{item.id}/comment" do |f|%>
<%= f.label :body, "Write"%>
<%= f.text_field :body%>
<%= f.submit "Comment" %>
<% end %>
The method in my items controller is access, but the comment does not save.
Here's my items controller.
def comment
@comment = Comment.build_from( @item, @current_user.id, params[:body])
if @comment.save
redirect_to @item
this is only here to confirm that the comment did not save
else
redirect_to items_path, notice: "Did not work"
end
end
Why won't the comment save? I can get it to save in the rails console.
Try investigating using the "pry" gem.
On Oct 7, 2012, at 10:56 PM, BonesVI notifications@github.com wrote:
This is my view
<%= form_for (:comment), :url => "#{item.id}/comment" do |f|%>
<%= f.label :body, "Write"%>
<%= f.text_field :body%>
<%= f.submit "Comment" %>
<% end %>
The method in my items controller is access, but the comment does not save.
Here's my items controller.
def comment
@comment = Comment.build_from( @item https://github.com/item, @
current_user.id, params[:body])
if @comment.save
redirect_to @item
#this is only here to confirm that the comment did not save
else
redirect_to items_path, notice: "Did not work"
end
end
Why won't the comment save? I can get it to save in the rails console.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/36.