Last active
August 29, 2015 14:15
-
-
Save juanfgs/47428af01015c646075e to your computer and use it in GitHub Desktop.
issues with recaptcha
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
class CommentsController < ApplicationController | |
def create | |
@post = Post.find(params[:comment][:post_id]) | |
@comment = Comment.new | |
@comment.name = params[:comment][:name] | |
@comment.comment = params[:comment][:comment] | |
if verify_recaptcha(:model => @comment) && @comment.valid? | |
@post.comments << @comment | |
redirect_to :back, flash: {message: "Thank you for your comment "} | |
else | |
@comment.errors.each do |attribute, error| | |
flash[attribute] = error | |
end | |
redirect_to :back | |
end | |
end | |
end | |
end | |
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
Recaptcha.configure do |config| | |
config.public_key = '6LeI7wETAAAAALTGxu5UeNAaZhTHem7Ar9g49dXG' | |
config.private_key = '6LeI7wETAAAAANW3wF3k3AOcxat6uxhGJHghWKf6' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment