Class: CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CommentsController
- Defined in:
- lib/generators/jinda/templates/app/controllers/comments_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/jinda/templates/app/controllers/comments_controller.rb', line 3 def create # $xvars['p'] is the query parameters like params in rails guide: # private # def comment_params # params.require(:comment).permit(:commenter, :body) # end # @article = Article.find($xvars['p']['comment']['article_id']) @comment = @article.comments.new( body: $xvars['p']['comment']['body'], user_id: $xvars["user_id"]) @comment.save! end |