I am developing an application where a user can post an issue and comment on it < / P>
The code for the issues is / show.html.erb
& lt; H1 & gt; & Lt;% = @ issue.title% & gt; & Lt; / H1> & Lt; Br / & gt; & Lt; H3 & gt; & Lt;% = @ issue.content% & gt; & Lt; / H3 & gt; & Lt; Br / & gt; & Lt;% = link_to "edit",: admin = & gt; 'Issues',: verb = & gt; 'Edit',: id = & gt; @ Issue.id% & gt; & Lt; H2 & gt; No comment & lt; / H2 & gt; & Lt;% = Render @ issue Depression% & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt;% = simple_form_for [uroshu, comment.new] F | & Gt%; & Lt;% = f.label: Content% & gt; & Lt; Br / & gt; & Lt;% = f.input: Content% & gt; & Lt;% = f.submit "Comment"% & gt; & Lt;% end% & gt;
and the comment is for code controller
class commentscontroller & lt; ApplicationController def @issue = Issue.find (params [: issue_id]) @comment = @ issue.comments.create (comment_params) If @ comment.save redirect_to: admin = & gt; 'Issues',: verb = & gt; 'Show' and render 'new' end-end personal def comment on the counter. (Review :) .permit (content) and end
and the comment is partial for code
% comment content% Gt;
On running this code, the rail is throwing an error - undefined method content, while the content is the name of a column in my application
comment should not try to use partial @comment
, it's just using comment
The Rail Render
method will be set on every comment object in the @ issue.comments
as it runs partially.
For more information on this information.
No comments:
Post a Comment