Daniel Oton wrote in post #970865: > Hello! > > I'm using restful_authentication
Please replace it with Authlogic or Devise as soon as possible. restful_authentication is hard to work with due to its reliance on unmaintainable generated code. > and I would like to have diferent views > for logged users and not logged users. Logged users can edit and create > items, and not logged user could only list items and show its features. > > In my routes file I have: > > map.namespace :admin do |admin| > map.resources :items, :controller => "admin/items", :path_prefix => > 'admin' > end > > map.resources :items > > In my views I have: > <%= link_to '<b>Items</b>', items_path %> > > The link_to always redirect to admin/item/index (except if I change the > order in routes.rb, if I do always redirect to item/index). > > Is it possible to redirect admin/item/index when user is logged in and > redirect to item/index when user is not logged in? Sure. You could test current_user and build the link accordingly. But I'd recommend against doing this. Instead, have a separate "admin login" link on the items index page. That way you don't have to be checking logins all the time. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone But I'd rec > > Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.