0

I am working with Devise and I am trying to override the registrations controller.

I have followed posts on here with no luck.

This is what I have:

 class AccountsController::RegistrationsController < Devise::RegistrationsController
  def new
    super
  end
 end

   devise_for :accounts, :controllers => {:registrations => "accounts/registrations"} do
     get "welcome" => "accounts#new", :as => :new_account
   end

I also created an account folder in views and added the new view.

I receive the following error:

 app/controllers/accounts_controller.rb:1:in `<top (required)>'
Brian
  • 5,821
  • 14
  • 51
  • 76

2 Answers2

1

@Brian is correct it will work but you want your code have to work just change:

class AccountsController::RegistrationsController < Devise::RegistrationsController

to:

class Accounts::RegistrationsController < Devise::RegistrationsController

Then create an accounts folder in the controller folder and place this file to that folder.

Jake1164
  • 12,212
  • 6
  • 43
  • 62
G SubbaRao
  • 460
  • 2
  • 15
0

Mine was a little different, but this solved the problem. Override devise registrations controller

  class RegistrationsController < Devise::RegistrationsController
def new
    @test = "test"
    super
end
  end

The I added the following to my views registrations/new.html.erb

Then:

  devise_for :accounts, :controllers => {:registrations => "registrations"} do
  get "welcome" => "registrations#new", :as => :new_account
  end
Community
  • 1
  • 1
Brian
  • 5,821
  • 14
  • 51
  • 76