aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'docrails/master'Xavier Noria2013-11-241-1/+1
|\ | | | | | | | | | | Conflicts: activesupport/lib/active_support/core_ext/hash/deep_merge.rb activesupport/lib/active_support/core_ext/hash/keys.rb
| * Change syntax format for example returned valuesPrem Sichanugrist2013-11-111-1/+1
| | | | | | | | | | | | | | | | | | According to our guideline, we leave 1 space between `#` and `=>`, so we want `# =>` instead of `#=>`. Thanks to @fxn for the suggestion. [ci skip]
* | Avoid hash lookups for building an array of required defaultsCarlos Antonio da Silva2013-11-151-2/+3
| | | | | | | | Only set the value once after it's calculated.
* | Get rid of useless temp variableCarlos Antonio da Silva2013-11-151-2/+1
| |
* | Set values instead of building hashes with single values for mergingCarlos Antonio da Silva2013-11-151-2/+2
| |
* | avoiding next statementsAkshay Vishnoi2013-11-151-9/+12
| |
* | Improve Errors when Controller Name or Action isn't specfiedGaurish Sharma2013-11-051-2/+4
|/ | | | | | | | | | These errors occur when, there routes are wrongly defined. example, the following line would cause a missing :action error root "welcomeindex" Mostly beginners are expected to hit these errors, so lets improve the error message a bit to make their learning experience bit better.
* Revert "Merge pull request #12208 from mjhoy/patch-1"Rafael Mendonça França2013-09-121-0/+4
| | | | | | | | This reverts commit ab5cd54b7e791f8419f689d1bef5394890268a6f, reversing changes made to cdc10c898d4865302740340eedec4f5f4ca76565. Reason: This way of defining root path is still supported. See https://github.com/rails/rails/blob/d262773ab7f0aae5de2d354ac2eca168e95b653d/actionpack/test/controller/routing_test.rb#L450-457
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2013-09-131-10/+10
|\
| * Change documentation to consistently refer to the same objectEarl J St Sauver2013-09-081-8/+8
| | | | | | | | | | | | The documentation in this section is referring to a profile, so the resource that's created should probably also be a profile of some sort.
| * Blacklist refferenced in docs is actually whitelistEarl J St Sauver2013-09-081-2/+2
| | | | | | | | | | | | The docs refference a blacklist, but really what's being described is a whitelist. Anything that matches the constraint gets through to the path.
* | remove outdated docsMichael Hoy2013-09-121-4/+0
| |
* | Update mapper documenation for match helper [ci skip]Earl St Sauver2013-08-301-2/+3
|/ | | | | | | | This piece of documentation is out of date. The use of match without any via option is prevented, now the HTTP verbs have to be explicitly set. If they're not set then the error message in normalize_conditions! (around line 186) is shown.
* Fix shorthand routes where controller and action are in the scopeAndrew White2013-06-251-2/+10
| | | | | | | | | Merge `:action` from routing scope and assign endpoint if both `:controller` and `:action` are present. The endpoint assignment only occurs if there is no `:to` present in the options hash so should only affect routes using the shorthand syntax (i.e. endpoint is inferred from the the path). Fixes #9856
* Add has_named_route? to the mapper APIJosé Valim2013-05-201-0/+5
|
* Rack::Mount was replaced by Journey, Fixed commentGaurish Sharma2013-04-301-1/+1
|
* extract arrays to constants in MapperVipul A M2013-04-221-2/+4
|
* Mark unused variables and make some style fixesAgis Anastasopoulos2013-04-081-2/+2
| | | | It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
* Refactoring some reused code into a method (inside of the routeswangjohn2013-04-051-12/+13
| | | | mapper) and adding a constant for all the possible scopes.
* Merge pull request #9932 from senny/9913_routing_problemAndrew White2013-04-031-8/+12
|\ | | | | routing bugfixes when matching multiple paths
| * routing shorthand syntax works with multiple pathsYves Senn2013-03-261-5/+6
| | | | | | | | | | | | Closes #9913. We need to expand the match shorthand syntax for every path.
| * bugfix, when matching multiple paths with `get`, `post`, ...Yves Senn2013-03-261-3/+6
| | | | | | | | | | | | This problem was introduced with: https://github.com/rails/rails/commit/d03aa104e069be4e301efa8cefb90a2a785a7bff
* | fix regression in Mapper when `format:` was used in a `scope`.Yves Senn2013-04-031-1/+1
|/ | | | | | | Closes #10071 `#normalize_path!` depends on the options so we need to call `#normalize_options!` first to make sure everything is set correctly.
* Routing match `via` option requirement exception message made more explicitBoris Staal2013-03-051-1/+2
|
* Remove redundant methodAndrew White2013-02-281-8/+0
|
* `format: true` does not override existing format constraints.Yves Senn2013-02-271-1/+1
| | | | | | | Closes #9466. Passing `format: true` used to override the constraints: { format: /json/ } with `/.+/`. This patch only sets the format if there is no constraint present.
* the router allows String contraints.Yves Senn2013-02-261-11/+17
| | | | Closes #9432.
* Allow both a path and an option on root in config/routesSam Ruby2013-02-261-2/+9
|
* determine the match shorthand target early.Yves Senn2013-02-211-14/+12
| | | | | | | | Closes #7554. This patch determines the `controller#action` directly in the `match` method when the shorthand syntax is used. this prevents problems with namespaces and scopes.
* the `:controller` option for routes can contain numbers. closes #9231.Yves Senn2013-02-091-1/+1
|
* ruby constant syntax is not supported as routing `:controller` option.Yves Senn2013-02-061-0/+6
| | | | | | | | | | The current implementation only works correctly if you supply the `:controller` with directory notation (eg. `:controller => 'admin/posts'`). The ruby constant notation (eg. `:controller => 'Admin::Posts`) leads to unexpected problems with `url_for`. This patch prints a warning for every non supported `:controller` option. I also added documentation how to work with namespaced controllers. The warning links to that documentation in the rails guide.
* Missing or unneeded require extract_optionsAkira Matsuda2013-02-011-0/+1
|
* Duplicate possible frozen string from routeAndrew White2013-01-211-2/+3
| | | | | | | | | | | | | Ruby 1.9 freezes Hash string keys by default so where a route is defined like this: get 'search' => 'search' then the Mapper will derive the action from the key. This blows up later when the action is added to the parameters hash and the encoding is forced. Closes #3429
* Change the behavior of route defaultsAndrew White2013-01-151-1/+8
| | | | | | | | | | | | | | | | | | | This commit changes route defaults so that explicit defaults are no longer required where the key is not part of the path. For example: resources :posts, bucket_type: 'posts' will be required whenever constructing the url from a hash such as a functional test or using url_for directly. However using the explicit form alters the behavior so it's not required: resources :projects, defaults: { bucket_type: 'projects' } This changes existing behavior slightly in that any routes which only differ in their defaults will match the first route rather than the closest match. Closes #8814
* Add support for other types of routing constraintsAndrew White2013-01-151-103/+149
| | | | | | | | | | | | | | This now allows the use of arrays like this: get '/foo/:action', to: 'foo', constraints: { subdomain: %w[www admin] } or constraints where the request method returns an Fixnum like this: get '/foo', to: 'foo#index', constraints: { port: 8080 } Note that this only applies to constraints on the request - path constraints still need to be specified as Regexps as the various constraints are compiled into a single Regexp.
* clearer conditional in constraint match checkGosha Arinich2013-01-101-3/+3
|
* refactor Routing::MapperGosha Arinich2013-01-031-9/+4
|
* Fix usage of lambda as a Rack endpointJiri Pospisil2012-12-311-2/+2
| | | | The response body needs to respond_to? :each.
* Merge pull request #8412 from ↵Rafael Mendonça França2012-12-051-18/+14
|\ | | | | | | | | JoeyButler/action_dispatch_routing_mapper_refactoring Extract method refactoring.
| * Extract method refactoring in ActionDispatch::Routing::SingletonResource.Joey Butler2012-12-051-18/+14
| |
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-12-041-4/+0
|\ \ | | | | | | | | | | | | Conflicts: guides/source/migrations.md
| * | Cleans and removes useless 'Examples' tag [ci skip]Alvaro Pereyra2012-12-011-4/+0
| |/
* / Fixed issue where routes with globs caused constraints on that glob toMaura Fitzgerald2012-12-041-1/+1
|/ | | | | | be ignored. A regular expression constraint gets overwritten when the routes.rb file is processed. Changed the overwriting to an ||= instead of an = assignment.
* Refector a bit to remove extra slice iteration and splat callCarlos Antonio da Silva2012-11-241-2/+2
| | | | | | | | | This yields a small bit of performance improvement when building the defaults from constraints, specially considering that it's rather common for constraints to be empty. Also, there's a bit of duplicated code in here that I have to check before extracting.
* Use merge! in some places to avoid creating extra hashesCarlos Antonio da Silva2012-11-241-3/+3
|
* Simplify scope options recovery by using merge!Carlos Antonio da Silva2012-11-241-6/+1
| | | | | | Instead of iterating again over the options and setting one by one, we can just merge the recover hash back to the scope one since all keys match.
* Normalize scope recovering :blocks option nameCarlos Antonio da Silva2012-11-241-3/+3
| | | | | Use the same :blocks key in the recover hash to revert the scope options later.
* Simplify constraints condition in scope when checking for HashCarlos Antonio da Silva2012-11-241-7/+4
|
* Allow setting a symbol as path in scope on routesGuillermo Iguaran2012-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Was surprising found that this example doesn't work: scope :api do resources :users end and the right form to use it is: scope 'api' do resources :users end I think this should work similary as `namespace` where both are allowed. These two are equivalent: namespace :api do resources :users end namespace 'api' do resources :user end
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-171-17/+22
|\ | | | | | | | | Conflicts: actionpack/lib/action_dispatch/routing/redirection.rb