views:

189

answers:

1

I want to add the option to register with a JSON format and some other specific stuff to my application. I've tried adding my own RegistrationsController controller and then setting my routes to look like this:

devise_for :users, :path_names => { :sign_in => 'signin', :sign_out => 'signout', :sign_up => 'signup' }
match 'signin', :to => 'devise/sessions#new', :as => "new_user_session"
match 'signout', :to  => 'devise/sessions#destroy', :as => "destroy_user_session"
match 'signup(.:format)', :to => 'registrations#new', :as => "new_user_registration"

My RegistrationsController in app/controllers/registrations_controller.rb looks like this:

class RegistrationsController < Devise::RegistrationsController
  prepend_view_path "app/views/devise"
  def create
    # My custom implementation
  end
end

It always throws the following error regardless of the format

AbstractController::ActionNotFound (AbstractController::ActionNotFound):
/usr/local/Cellar/Gems/1.8/gems/devise-1.1.rc2/lib/devise/controllers/internal_helpers.rb:57:in `is_devise_resource?'
...

I even tried adding the registrations controller from git to app/controllers/devise/registrations_controller.rb and changing the routes to point that one instead, but that didn't work either. Anyone have an idea?

A: 

Figured it out! I was trying to override create in the registrations controller, but didn't route to it... Stupid mistake.

devise_for :users, :path_names => { :sign_in => 'signin', :sign_out => 'signout', :sign_up => 'signup' }, :controllers => { :registrations => "registrations" }
match 'signin', :to => 'devise/sessions#new', :as => "new_user_session"
match 'signout', :to  => 'devise/sessions#destroy', :as => "destroy_user_session"
get 'signup', :to => 'registrations#new', :as => "new_user_registration"
post 'signup(.:format)', :to => 'registrations#create', :as => "create_user_registration"
Sam Soffes