You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
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
Greg Navis
unread,
Jun 13, 2016, 1:42:59 PM6/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
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?
--
Greg Navis
I help tech companies to scale Heroku-hosted Rails apps.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
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.