Method: FeatureBox::CommentsController#create
- Defined in:
- app/controllers/feature_box/comments_controller.rb
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/feature_box/comments_controller.rb', line 7 def create suggestion =Suggestion.find(params["suggestion_id"]) @comment.text = params["comment"]["text"] @comment.user = current_user @comment.suggestion = suggestion if @comment.save redirect_to suggestion, notice: 'Comment was successfully added.' else redirect_to suggestion, :flash => { #TODO: it can be anything, not only empty comment :error => 'Comment cannot be empty' } end end |