achiurizo / rack-recaptcha

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

Rails setup #4

Closed eric-hu closed 13 years ago

eric-hu commented 13 years ago

Perhaps this is the wrong place for this, but I just wanted to point out that the rails setup instructions didn't work for me. I had to tweak the following code:

## environment.rb:
config.gem 'rack-recaptcha', :lib => 'rack/recaptcha'
config.middleware.use Rack::Recaptcha, :public_key => 'KEY', :private_key => 'SECRET', :paths => 'PATH'

That gave me the following error:

undefined local variable or method `config' for main:Object (NameError)

I just needed to pre-pend the config... part with "Rails.application."

Rails.application.config.gem 'rack-recaptcha', :lib => 'rack/recaptcha'
Rails.application.config.middleware.use Rack::Recaptcha, :public_key => 'KEY', :private_key => 'SECRET', :paths => 'PATH'
achiurizo commented 13 years ago

i've updated the README. these configurations should have been in the application.rb, not environment.rb. thanks