Redirect from a template based on Devise

Hi,

I’m trying to lock down a specfic template in my rails application to a particular user type, but only have a sinlge user model at the moment. There is a method that determines if the logged in user can access that page. Is this not possible within rails, and I have to do this at the controller level.

I was hoping that I could just simply put something like this into the template.

<%= current_user.reviewer? redirect: 401 %>

but I can’t find anything that seems able to do a redirect from the template.

Cheers
Michael

I'm not sure whether this is possible at all. Even if it is, it'll violate
the principle of least surprise. Could you tell a bit more about what you
want to achieve so we might be able to suggest an alternative design?

Hi Greg,

I was trying to prevent non reviewers from seeing the full list of users by raising an unathorised error within the Devise users template.

I’ve modified the display so they can only see their own account, and I realise I could do this by customising the controller, but I wanted something quick and easy.

Cheers
Michael