I am creating a simple application and creating a simple application where a user can add a term and then add comments to that post is. Code for model
# = schema information # # Table name: # # id: comments # # integer null, primary key # issue_id: integer # content: text # created: date time # Updated_at: datetime # class comment & lt; ActiveRecord :: Base is_to: problem ending
is the code for the controller
class commentsControler & 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; The 'index' and 'new' end-end DEF end up making personal def commenter on the parameters. Request (comment). Pure (: content) end-end
The Ben Controller has been added to issue the following support:
has_many: comments
When I enter the data in the form, the rail does not save the data in the database, instead it shows me
When you declare methods in Ruby Class, the final definition of the law overrides any previous declaration whose only method is signature (method name and title). A hundred).
You have two forming
methods, with one argument and another one empty. Because the second one is empty, it is being run instead of the first, where all your arguments are.
No comments:
Post a Comment