On 19 December 2010 09:33, Paul Bergstrom <[email protected]> wrote:
> How do I deal with a page called "me" that displays information about
> the user? I can see the benefit of routes in a basic database app with
> list, view, edit, show. But I don't understand the logic for examples
> like mine. In my case it will make much more sense for the user to go to
> a page called "me" than "user/2".

  # routes.rb
  map.me 'me', :controller => 'users', :action => 'display_current_user'

  # UsersController
  def display_current_user
    @user = current_user # assuming you do have a current_user method
    ... [rest of action code]
  end

...which gives you access to "me_path" and all the other routes
helping malarkey.

http://api.rubyonrails.org/classes/ActionDispatch/Routing.html

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to