pludoni / simple-captcha

Rails 3+4 support now! Simple Captcha is the simplest and a robust captcha plugin. Its implementation requires adding up a single line in views and in controllers/models.
MIT License
106 stars 73 forks source link

Integration with Devise #32

Closed x44x45x41x4E closed 9 years ago

x44x45x41x4E commented 9 years ago

Hi,

I was wondering on how to implement this with Devise? Tried following the steps given but I get a PG::Undefined_Table error looking for simple_captcha_data table. I followed both Controller-based and Model-based examples. Any help would be appreciated.

Thank you.

EDIT: I think I got it now. I'll close this at a later time for reference.

zealot128 commented 9 years ago

There is nothing special with devise, if you are using your own controllers. Did you run the installation? rails generate simple_captcha


Recently, I created a rewrite of this Gem, because a lot of cruft accumulated, and integrating new features, like a Refresh-Button or different Captcha variants was not clear and untested. https://github.com/zealot128/simple_captcha_reloaded This integrates better through the Rails engine interface, thus the migrations are copied before:

rake simple_captcha_reloaded:install:migrations
rake db:migrate
x44x45x41x4E commented 9 years ago

@zealot128 Hey man. Thanks for the quick reply. Yep. I realized that I didn't ran through with the setup. Got it working now. Only thing left is how I would validate it along with devise. I'll check out your work too man. Thanks again.

zealot128 commented 9 years ago

you need to run "valid_with_captcha?" or "save_with_captcha" at one point to run all validations + captcha. If you are using the controller integration, than you need to check yourself and display the error yourself.