I am working on an application that someone else wrote, trying to add some enhancements and UI tweaks.
I want something along the lines of the Devise ‘current_user’ helper which I can use in my view to alter the UI a little bit. But all the authentication and authorization is hand-written.
Ideally, I want to be able to do something along the lines of the following:
<% if current_user.interface_id == 1 %>
<%= link_to 'Something', something_path %>
<% else %>
<%= link_to 'Something Else', something_else_path %>
<% end %>
Thoughts on the best way to go about implementing something like that?
To get a
current_userobject available to both your controllers and views, you could add something like this toapp/controllers/application_controller.rb: