aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing.rb
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-11-03 01:56:16 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-11-03 01:56:16 +0530
commit3b0bb08699ce409b8213c82956dc34086dcbc8b9 (patch)
tree34398e3421fcfd86aab2b5fc757175dd2ce7664d /actionpack/lib/action_dispatch/routing.rb
parent974467d70d337d4c60414c792e275d367143217b (diff)
parentee917493e451e552fef18367f8bcba2f36080685 (diff)
downloadrails-3b0bb08699ce409b8213c82956dc34086dcbc8b9.tar.gz
rails-3b0bb08699ce409b8213c82956dc34086dcbc8b9.tar.bz2
rails-3b0bb08699ce409b8213c82956dc34086dcbc8b9.zip
Merge branch 'master' of github.com:lifo/docrails
Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb activerecord/lib/active_record/attribute_methods.rb guides/source/working_with_javascript_in_rails.md
Diffstat (limited to 'actionpack/lib/action_dispatch/routing.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb
index 29090882a5..4417cb841a 100644
--- a/actionpack/lib/action_dispatch/routing.rb
+++ b/actionpack/lib/action_dispatch/routing.rb
@@ -61,7 +61,7 @@ module ActionDispatch
# directory by using +scope+. +scope+ takes additional options which
# apply to all enclosed routes.
#
- # scope :path => "/cpanel", :as => 'admin' do
+ # scope path: "/cpanel", as: 'admin' do
# resources :posts, :comments
# end
#
@@ -78,22 +78,22 @@ module ActionDispatch
# Example:
#
# # In routes.rb
- # match '/login' => 'accounts#login', :as => 'login'
+ # match '/login' => 'accounts#login', as: 'login'
#
# # With render, redirect_to, tests, etc.
# redirect_to login_url
#
# Arguments can be passed as well.
#
- # redirect_to show_item_path(:id => 25)
+ # redirect_to show_item_path(id: 25)
#
# Use <tt>root</tt> as a shorthand to name a route for the root path "/".
#
# # In routes.rb
- # root :to => 'blogs#index'
+ # root to: 'blogs#index'
#
# # would recognize http://www.example.com/ as
- # params = { :controller => 'blogs', :action => 'index' }
+ # params = { controller: 'blogs', action: 'index' }
#
# # and provide these named routes
# root_url # => 'http://www.example.com/'
@@ -110,43 +110,43 @@ module ActionDispatch
# end
#
# # provides named routes for show, delete, and edit
- # link_to @article.title, show_path(:id => @article.id)
+ # link_to @article.title, show_path(id: @article.id)
#
# == Pretty URLs
#
# Routes can generate pretty URLs. For example:
#
- # match '/articles/:year/:month/:day' => 'articles#find_by_id', :constraints => {
- # :year => /\d{4}/,
- # :month => /\d{1,2}/,
- # :day => /\d{1,2}/
+ # match '/articles/:year/:month/:day' => 'articles#find_by_id', constraints: {
+ # year: /\d{4}/,
+ # month: /\d{1,2}/,
+ # day: /\d{1,2}/
# }
#
# Using the route above, the URL "http://localhost:3000/articles/2005/11/06"
# maps to
#
- # params = {:year => '2005', :month => '11', :day => '06'}
+ # params = {year: '2005', month: '11', day: '06'}
#
# == Regular Expressions and parameters
# You can specify a regular expression to define a format for a parameter.
#
# controller 'geocode' do
- # match 'geocode/:postalcode' => :show, :constraints => {
- # :postalcode => /\d{5}(-\d{4})?/
+ # match 'geocode/:postalcode' => :show, constraints: {
+ # postalcode: /\d{5}(-\d{4})?/
# }
#
# Constraints can include the 'ignorecase' and 'extended syntax' regular
# expression modifiers:
#
# controller 'geocode' do
- # match 'geocode/:postalcode' => :show, :constraints => {
- # :postalcode => /hx\d\d\s\d[a-z]{2}/i
+ # match 'geocode/:postalcode' => :show, constraints: {
+ # postalcode: /hx\d\d\s\d[a-z]{2}/i
# }
# end
#
# controller 'geocode' do
- # match 'geocode/:postalcode' => :show, :constraints => {
- # :postalcode => /# Postcode format
+ # match 'geocode/:postalcode' => :show, constraints: {
+ # postalcode: /# Postcode format
# \d{5} #Prefix
# (-\d{4})? #Suffix
# /x
@@ -172,9 +172,9 @@ module ActionDispatch
# Suppose you get an incoming request for <tt>/blog/edit/22</tt>, you'll end
# up with:
#
- # params = { :controller => 'blog',
- # :action => 'edit',
- # :id => '22'
+ # params = { controller: 'blog',
+ # action: 'edit',
+ # id: '22'
# }
#
# By not relying on default routes, you improve the security of your
@@ -193,8 +193,8 @@ module ActionDispatch
#
# Examples:
#
- # match 'post/:id' => 'posts#show', :via => :get
- # match 'post/:id' => 'posts#create_comment', :via => :post
+ # match 'post/:id' => 'posts#show', via: :get
+ # match 'post/:id' => 'posts#create_comment', via: :post
#
# Now, if you POST to <tt>/posts/:id</tt>, it will route to the <tt>create_comment</tt> action. A GET on the same
# URL will route to the <tt>show</tt> action.
@@ -249,7 +249,7 @@ module ActionDispatch
# === +assert_routing+
#
# def test_movie_route_properly_splits
- # opts = {:controller => "plugin", :action => "checkout", :id => "2"}
+ # opts = {controller: "plugin", action: "checkout", id: "2"}
# assert_routing "plugin/checkout/2", opts
# end
#
@@ -258,7 +258,7 @@ module ActionDispatch
# === +assert_recognizes+
#
# def test_route_has_options
- # opts = {:controller => "plugin", :action => "show", :id => "12"}
+ # opts = {controller: "plugin", action: "show", id: "12"}
# assert_recognizes opts, "/plugins/show/12"
# end
#