achiurizo / rack-recaptcha

Rack Middleware for CAPTCHA verification via Recaptcha API
twitter.com/arthur_chiu
MIT License
151 stars 23 forks source link

uninitialized constant Rack::Recaptcha::Net #8

Closed mrbrdo closed 13 years ago

mrbrdo commented 13 years ago

I am getting this error when I submit a form with recaptcha_tag (no matter what I do in the controller, even if I don't call recaptcha_valid?). I am using Rails 3.0.5 and Ruby 1.8.7 on OS X. I've followed all the steps from the README. I tried using thin or WeBRICK, but it's the same.

NameError (uninitialized constant Rack::Recaptcha::Net):

Rendered /Users/mrbrdo/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms) Rendered /Users/mrbrdo/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (9.3ms) Rendered /Users/mrbrdo/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (652.8ms)

achiurizo commented 13 years ago

i bumped a new version 0.4.1 with the fix which explicitly requires net/http here: 2481d55860397a283a9a8fc0c478e2ee89815ab0. let me know how that works out for you. if it persists please re-open this ticket thanks

mrbrdo commented 13 years ago

Yes, that fixed that. I'm getting another error now, I think I've solved this once before (a few months ago when I first used this), probably I am missing some include: undefined method `recaptcha_valid?' for #CommentsController:0x102ed0ac8

Maybe you should also update the README to include the necessary step, I think it's not included.

mrbrdo commented 13 years ago

I fixed it by adding include Rack::Recaptcha::Helpers to application_controller.rb as well. In the README, you only include in in the application_helper. Maybe you should update the README accordingly.

mrbrdo commented 13 years ago

Seems fine.

achiurizo commented 13 years ago

I've made the README explicitly clear now on how to integrate with Rails, including tips like how you can include this in specific controllers. hope this suits your needs. thanks