I am using Devise 2.0.0 and Rails 3.2.3 on OSX.
Is it possible to override both a Devise controller and a Devise view at the same time?
I was successfully overriding the confirmations/new view with my own scoped view, located in views/users/confirmations/new.html.erb. The scoped view was working fine.
Then I found it necessary to override the Devise::ConfirmationsController with my own controller, AppConfirmationsController, in order to customize the after_confirmation_path_for method to return my own custom path.
class AppConfirmationsController < Devise::ConfirmationsController
protected
def after_confirmation_path_for(resource_name, resource)
confirmed_app_custom_path
end
end
I altered the route so that my custom controller would be used
devise_for :users, :controllers => {:confirmations => 'app_confirmations'}
The new controller is working fine, but my scoped view is no longer being recognized. Instead of rendering my scoped view, the devise default view is being rendered. If I stop using my custom controller, my scoped view starts working again.
Am I missing some configuration setting that affects scoped views when using a customer controller?
Not sure if this will work since I wasn’t using scoped views, but I ran into a similar problem when overriding the default devise registration view and controller.
For me I had to make sure the parent directory of my view had the same name as the new devise controller, and everything worked fine.
i.e.
devise_for :users, :controllers => { :registrations => "app_registrations" }and then my custom controller at
views/app_registrations/new.html.erbDoes moving your view to
views/users/app_confirmations/new.html.erbhelp?