Reputation: 1869
I am getting this error when pressing submit on my form with reCaptcha:
NameError in PostsController#create
undefined local variable or method `verify_captcha' for #<PostsController:0x007fcf52e84b48>
I have the gem installed with the registered private and public keys from the recaptcha website and the keys in the config file. I have ran 'bundle install'. The captcha works on the form as I am able to refresh new codes.
#gemfile
gem "recaptcha", :require => "recaptcha/rails"
#controller
respond_to do |format|
if verify_captcha and @post.save
format.html { redirect_to @post, notice: 'Post was successfully created.' }
else
format.html { render action: "new" }
end
end
Why isn't rails recognizing the 'verify_captcha' method from the Recaptcha gem library? Any one know a fix?
Upvotes: 1
Views: 243
Reputation: 27779
I believe the method is called verify_recaptcha
, not verify_captcha
.
Upvotes: 1