Metal
Metal

Reputation: 205

Configuring routes in rails application

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

Answers (2)

Andrei S
Andrei S

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

ceth
ceth

Reputation: 45295

May be create condition in the template:

<% if @currentUser.isAdmin %>
....
# image link one
....

<% else %>
....
# image link two
....
<% end %>

Upvotes: 1

Related Questions