Created
March 10, 2010 16:10
-
-
Save ilake/328011 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby script/console | |
>> app.url_for :controller => :public, :action => :about | |
=> "http://example.com/public/about" | |
>> app.get("/public") | |
=> 200 | |
>> app.get("/ryan") | |
=> 404 | |
# others include | |
>> app.response.headers | |
>> app.response.body[0,75] | |
>> app.post("/collection/add/1") | |
>> app.response.redirected_to | |
>> app.follow_redirect! | |
# fix errors in your code, then... | |
>> reload! | |
#===================== | |
>> irb ActionController::Routing::Routes | |
>> puts routes | |
ANY / {:action=>"index", :controller=>"public"} | |
... | |
ANY /:controller/:action/:id.:format/ {} | |
# independently play with paths | |
>> recognize_path "/about" | |
=> {:controller=>"public", :action=>"about"} | |
>> recognize_path "/public" | |
=> {:controller=>"public", :action=>"index"} | |
# or check a path inversely | |
>> generate :controller => "public", :action => "about" | |
=> "/about" | |
>> generate :controller => "public", :action => "index" | |
=> "/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment