will initialize break the layout settings in rails?

Viewed 4595

In one of the controller, I need a specific layout. I added layout at the beginning. It works well.

But if I add an initialize function for some controller-based variable. Rails seems just ignore the layout command.

Is anyone have same problem? How can I fix it?

class AdminsController < ApplicationController

  layout "layout_admins"

  def initialize
    @Title = "Admins"
  end

  def index
    ....... some code here
  end
end
2 Answers
Related