Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Second devise model not using generated views

I have a User and a Rep model

devise_for :users, :controllers => {:registrations => 'user_registration'}
devise_for :reps

I ran

rails generate devise:views reps

The custom views show up in app/views/reps

But the rep paths are still using the built in devise views

Rendered ~/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.4.9/app/views/devise/registrations/edit.html.erb

Instead of the generated reps views.

like image 453
jfeust Avatar asked Nov 27 '22 02:11

jfeust


1 Answers

I had the same problem. I eventually spotted this in the documentation.

If you have more than one role in your application (such as “User” and “Admin”), you will notice that Devise uses the same views for all roles. Fortunately, Devise offers an easy way to customize views. All you need to do is set “config.scoped_views = true” inside “config/initializers/devise.rb”.

So I switched the config.scoped_views to true and it worked a charm :)

like image 164
John Polling Avatar answered Dec 11 '22 14:12

John Polling