Configuring routes in rails application
HI,
I have created a custom index page f开发者_如何转开发or 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.
May be create condition in the template:
<% if @currentUser.isAdmin %>
....
# image link one
....
<% else %>
....
# image link two
....
<% end %>
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
精彩评论