Note that there are some explanatory texts on larger screens.

plurals
  1. POInstall recaptcha gem with exsisting devise gem with rubymine 3.1
    text
    copied!<p>What I've tried doing already: I've tried reading the documentation at github and getting it to work on Rubymine and I've managed to confuse myself with what is needed as far as controllers, and what is needed in the config folder. I've tried google and found some pretty good tutorials but their missing steps that I don't necessarily know to jump too.</p> <p>What I'm trying to figure out: I want to be able use recaptcha in a login registration utlitizing the devise gem, I've already generated the pages for my devise login.</p> <p>What I have so far:</p> <p>I've installed and attached: devise 1.2.rc and recaptcha 0.3.1 I'm running Rubymine on windows xp. Ruby SDK 1.8.7-p302, with Rails 3.0.3</p> <p>I've been to google and have my public and private keys The next step tells me I'm supposed to add my keys to <strong>project/config/initializers/recaptcha.rb</strong> This is what is contained in that file:</p> <pre><code> Recaptcha.configure do |config| config.public_key = 'myKey' config.private_key = 'myKey' end </code></pre> <p>Now I'm supposed to fix up my <strong>gemfile</strong> with:</p> <pre><code> gem 'recaptcha', :require =&gt; 'recaptcha/rails' </code></pre> <p>I also have my <strong>config/application.rb</strong> reading:</p> <pre><code> require 'rails/all' require 'net/http' </code></pre> <p>I've also added to my <strong>External Libraries/[gem] devise/app/views/devise/registrations/new.html.erb</strong> the recaptcha tag:</p> <pre><code> &lt;%= recaptcha_tags %&gt; &lt;p&gt;&lt;%= f.submit "Sign up" %&gt;&lt;/p&gt; </code></pre> <p>Where I am running into issues (I think) is the <strong>app/controllers/registrations_controller.rb</strong> and the <strong>config/routes.rb</strong> </p> <p>I'm kinda of at a loss for what exactly goes into these files. Any help would be appreciated or a tutorial someone has written that walks me through this step by step would be very helpful. Thanks</p> <p>Here's what I have done after Felix's post:</p> <p><strong>external libraries/app/controllers/devise/registrations_controller.rb</strong></p> <p>class Devise::RegistrationsController &lt; Devise::RegistrationsController def create</p> <pre><code> if verify_recaptcha then super else build_resource clean_up_passwords(resource) flash[:notice] = 'Invalid Captcha' render_with_scope :new end build_resource if resource.save if resource.active? set_flash_message :notice, :signed_up sign_in_and_redirect(resource_name, resource) else set_flash_message :notice, :inactive_signed_up, :reason =&gt; resource.inactive_message.to_s expire_session_data_after_sign_in! redirect_to after_inactive_sign_up_path_for(resource) end else clean_up_passwords(resource) render_with_scope :new end end </code></pre> <p>From <strong>Project/config/routes.rb:</strong></p> <pre><code> devise_for :users, :controllers =&gt; {:registrations =&gt; 'registrations'} </code></pre> <p>This is the error that its spitting out:</p> <p>ActionController::RoutingError (uninitialized constant RegistrationsController):</p> <p>Rendered C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.0ms) ..... any ideas? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload