Question

I wanted to set layout to my Devise sign-in page, so I added the following to my ApplicationController:

class ApplicationController < ActionController::Base
  protect_from_forgery

  if devise_controller?
    layout "single_column_with_banner"
  end
 end

However, I get the following error: undefined method `devise_controller?' for ApplicationController:Class

I can see that the helper method is specified in devise.rb, but I just can't access it from application controller. I'm using Rails 3.2 (in process of migration from 2.3). Any clues where I should look at? As a last resort I can override SessionsController but I don't really want to do that yet.

Was it helpful?

Solution

It seems like layout can be specified without either device_controller? or overriding SessionsController. In order to specify layouts, place the following in application.rb:

config.to_prepare do
  Devise::SessionsController.layout "single_column_with_banner"
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top