Develop: override action in registration controller for Recaptcha

I am trying to override the create method from the registration controller in Devise to enable Recaptcha validation (as seen here and here ):

class RegistrationsController < Devise::RegistrationsController def create if verify_recaptcha super else build_resource clean_up_passwords(resource) flash[:alert] = "Bad words." render_with_scope :new end end end 

Also changed my .rb routes accordingly:

  map.devise_for :users, :controllers => {:registrations => "registrations"}, :path_names => { :sign_up => 'signup', :sign_in => 'login', :sign_out => 'logout' } 

When trying to visit a new registration page (with a new path name: http: // localhost: 3000 / users / signup ), the following errors appear:

 LoadError in RegistrationsController#new Expected /home/benoror/project/app/controllers/registrations_controller.rb to define RegistrationsController 

FULL ERROR TRACE

Any help was appreciated.

BTW , I am using Devise 1.0.11 and Rails 2.3.10, thanks!

+4
source share
1 answer

Is your controller in the "Users" module? If so, you will need

  class Users :: RegistrationsController 
and
  {: registrations => "users / registrations"} 

Edit: According to Jose Valim , user controllers do not work until Devise 1.1. There is no reason to develop on <Rails 3 IMHO. Sorry, I missed this in the original post.

+5
source

All Articles