-
-
Save andyh/7327750 to your computer and use it in GitHub Desktop.
This file contains 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
def create | |
parent_resource = params[:parent_type].constantize | |
parent_id = params[:parent_id] | |
# both of the above values are empty because both params are not passed as parameters. | |
@comment = parent_resource.find(parent_id).comments.create(comment_params.merge(account: current_account)) | |
respond_with :dashboard, @comment | |
end | |
private | |
def comment_params | |
params.require(:comment).permit(:comment_markdown) | |
end |
This file contains 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
<%= hidden_field :parent_type, parent.class %> | |
<%= hidden_field :parent_id, parent.id %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment