3

Is there a way I can use a separate template for devise login view(devise gem)

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Uchenna
  • 4,059
  • 6
  • 40
  • 73
  • possible duplicate of [different layout for sign\_in action in devise](http://stackoverflow.com/questions/4982073/different-layout-for-sign-in-action-in-devise) – IAmNaN Oct 15 '13 at 00:23

2 Answers2

6

See this Railscast for help: http://asciicasts.com/episodes/210-customizing-devise

You can run a 'rails generate devise_views' and all of your views will show up in a 'devise' folder.

The Login page will be under devise/sessions/new.html.erb

a3uge
  • 417
  • 4
  • 14
  • 1
    yes i no but but my application layout template is being user to yield the view, i want to have a sperate layout for my login page – Uchenna Apr 14 '11 at 18:54
  • I really don't understand what you are asking... You want your login in the application layout instead of the default user/sign_in? – a3uge Apr 14 '11 at 19:04
  • something like that but i want to specify a special layout for user/sign_in not the default – Uchenna Apr 14 '11 at 19:10
  • 1
    Oh, I see. See http://stackoverflow.com/questions/4982073/different-layout-for-sign-in-action-in-devise You have to create a layout switcher in your application controller. layout :layout_by_resource def layout_by_resource if devise_controller? && resource_name == :user && action_name == 'new' "nameofyourlayout" else "application" end end – a3uge Apr 14 '11 at 19:29
  • And then make a layout "user.html.erb" or whatever. – a3uge Apr 14 '11 at 19:29
  • rails generate devise_views does not work for me using rails 3.2.9 and devise 2.1.2. The answer below has got it correct "rails generate devise:views" – Darren Hicks Nov 18 '12 at 23:30
3

You can run the generator which will create all the necessary template files in app/views/devise.

$ rails generate devise:views

Mab879
  • 608
  • 16
  • 33
Eric London
  • 351
  • 2
  • 5