Created
October 24, 2016 16:33
-
-
Save karuna24s/1bc1fd66b28c5abd995cb92516e35418 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentsController < ApplicationController | |
before_action :set_destination | |
def create | |
@comment = current_user.comments.create(comment_params) | |
@comment.destination = @destination | |
@comment.save | |
redirect_to destination_path(@destination) | |
end | |
private | |
def set_destination | |
@destination = Destination.find(params[:destination_id]) | |
end | |
def comment_params | |
params.require(:comment).permit(:content) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment