Wednesday, June 16, 2010

Rails dynamic layout selection

controller:
class MyController < ApplicationController
layout :check_layout




private

def check_layout
return current_user.admin? ? "admin" : "application"
# current_user is user who logged in
end


end

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.