Say, I have this in one of the controllers:
def show
case current_user.role
when 'manager'
render :text => 'Manager view!'
when 'admin'
render :text => 'Admin view!'
end
end
The thing is, that instead of 'render', of course, there's a bunch of code and it all stops look pretty very fast. Also, I have some other actions in my controller, which have to perform differently for each of the user roles. What's the best way to refactor it without having to write some sorts of 'ifs' and 'cases' in the action's body? I'd like to have 2 files - one for each of the user roles; or at least two different actions.