Custom Devise views not working

时间:2015-06-11 09:51:14

标签: ruby-on-rails ruby devise

I am pretty sure I understand how to generate views and route to them with devise but this time I am using devise with 2 different types of models.

I have a 'User' modal and a 'Professional' modal. I have generated both views with

rails generate devise:views User & rails generate devise:views Professional

I have also set my routes to:

devise_for :users, :controllers => {:registrations => 'users'}
devise_for :users, :controllers => {:registrations => 'professionals'}

For some reason when I visit for example /users/sign_up rails is generating devise/registrations/new rather than my users/registrations/new,

Scopes are all set to true in Devise.rb.

Is there anything I am not doing right here/missing out?

As a side, When I remove the custom controller route, the views are generating correctly but it then uses the devise controllers and I don't want this.

1 个答案:

答案 0 :(得分:0)

当您更改devise的自定义路线时,您需要将其观看次数从devise/registrations移至users/registrations

devise尝试使用您的自定义控制器,但是当它无法找到合适的视图时,它会使用默认值。