Skip to content

Instantly share code, notes, and snippets.

@jem
Created November 28, 2011 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jem/1399348 to your computer and use it in GitHub Desktop.
Save jem/1399348 to your computer and use it in GitHub Desktop.
include url helpers
# To play with routes in the rails console from rails 3.1, use the following:
include Rails.application.routes.url_helpers
default_url_options[:host] = 'localhost:3000' # or whatever
# Now, can freely play with routes.
>> url_for User.first
=> "http://localhost:3000/users/7"
>> url_for [Pod.first, :tasks]
=> "http://localhost:3000/pods/8/tasks"
# etc.
@jem
Copy link
Author

jem commented Dec 9, 2011

this is now broken, just use app.url_for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment