Displaying routes in Rails console


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # this is the Rails 2 way
  2. script/console
  3. include ActionController::UrlWriter
  4. users_path
  5. user_path(123)
  6.  
  7. # this is the Rails 3 equivalent
  8. rails console
  9. include Rails.application.routes.url_helpers
  10. users_path
  11. user_path(123)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.