Warning: Creating default object from empty value in /homepages/39/d161420129/htdocs/p373.net/wp/wp-content/themes/p373b/admin/functions.php on line 183
ProTip: Don’t name your namespaced controllers “ApplicationController”

ProTip: Don’t name your namespaced controllers “ApplicationController”

Don’t do this:

class Admin::ApplicationController < ApplicationController
  layout "admin"
end

class Admin::IndexController < Admin::ApplicationController
end

This works for the most part except that the layout is not chosen properly.  Rails just chooses the default application.html.erb layout.

Instead, rename to something like this:

class Admin::BaseController < ApplicationController
  layout "admin"
end

class Admin::IndexController < Admin::BaseController
end

you’re welcome.

 

 

    This entry was posted in Coding, Ruby/Rails, Technology and tagged , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.