Reputation: 205
HI,
I have created a custom index page for my application , which has two image links , one for users and other for admin. How shall I configure the routes in the routes.rb, so that the links take to the dedicated pages.
Thanks.
Upvotes: 0
Views: 107
Reputation: 6516
if you have two controllers, say Admins and Users, you could say in your routes
resources :admins
resources :users
and in your index view write something like
<%= link_to 'admins', admins_path %>
<%= link_to 'users', users_path %>
for more about routing and rails in general please read the rails guides available here
Upvotes: 0
Reputation: 45295
May be create condition in the template:
<% if @currentUser.isAdmin %>
....
# image link one
....
<% else %>
....
# image link two
....
<% end %>
Upvotes: 1