I have the following controller for invitations provided by devise_invitable
class InvitationsController < Devise::InvitationsController
layout 'devise', only: [:edit]
layout "admin", only: [:new]
..........code.........
end
In a nutshell, I want the code to display the admin layout on the new action and the devise default layout on edit. I'd expect for the above code to work but what I've found is that the last layout call that I make clobbers everything. The above snippet will render admin for all actions and when I switch them around then the devise layout will clobber everything. I don't understand why that is.
I'm looking at this devise wiki here but I'm having no luck. What could I be doing wrong here?
CodePudding user response:
Stolen from this API page
class ApplicationController < ActionController::Base
layout :determine_layout
def determine_layout
if is_admin?
"admin"
else
"application"
end
...
end
