aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #19700 from tancnle/trivial-shallow-nesting-depth-countRafael Mendonça França2015-04-081-1/+1
|\ | | | | A shorter and more concise version of select..size
| * A shorter and more concise version of select..sizeTan Le2015-04-091-1/+1
| |
* | Improve shorthand matching for routesbrainopia2015-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shorthand route match is when controller and action are taken literally from path. E.g. get '/foo/bar' # => will use 'foo#bar' as endpoint get '/foo/bar/baz' # => will use 'foo/bar#baz' as endpoint Not any path with level two or more of nesting can be used as shortcut. If path contains any characters outside of /[\w-]/ then it can't be used as such. This commit ensures that invalid shortcuts aren't used. ':controller/:action/postfix' - is an example of invalid shortcut that was previosly matched and led to exception: "ArgumentError - ':controller/:action' is not a supported controller name"
* | Fix name_for_action in routingrono232015-01-191-2/+3
| |
* | Remove unneeded requiresRafael Mendonça França2015-01-041-1/+0
| | | | | | | | These requires were added only to change deprecation message
* | Remove deprecated support to define routes with `:to` option thatRafael Mendonça França2015-01-041-17/+2
| | | | | | | | doesn't contain `#`
* | Only check that it is a Rails application onceRafael Mendonça França2014-12-081-5/+7
| | | | | | | | Also avoid using try since is_a? is faster for this case.
* | Mounted Rack apps should have default named routes based on app nameT.J. Schuck2014-12-061-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression in 4.2.0 from 4.1.8. https://github.com/rails/rails/pull/17823 fixed a similar regression regarding _explicitly_ named routes for a mounted Rack app, but there was another regression for the default value. With a route like: Rails.application.routes.draw do mount Mountable::Web, at: 'some_route' end The "Prefix" column of rake routes gives the following: - 4.1.8: mountable_web - 4.2.0.beta1-4: [nothing] - 4.2.0.rc1: [nothing] - 4.2.0.rc2: some_route <- regression This fixes the default to go back to being based off the name of the class like the docs specify: https://github.com/rails/rails/blob/785d04e3109f69d0b9b9f4732179592f0ef04e52/actionpack/lib/action_dispatch/routing/mapper.rb#L558-L560 Explicitly named routes still work correctly per https://github.com/rails/rails/pull/17823: Rails.application.routes.draw do mount Mountable::Web, at: 'some_route', as: 'named' end - 4.1.8: named - 4.2.0.beta1-4: [nothing] - 4.2.0.rc1: [nothing] - 4.2.0.rc2: named
* | Pure rack apps can be mounted with a nameJean Boussier2014-11-291-7/+1
| | | | | | | | See https://github.com/rails/rails/commit/9b15828b5c347395b42066a588c88e5eb4e72279#commitcomment-8764492
* | Refactor nested ifBruno Sutic2014-11-261-5/+3
| |
* | Wrap code snippets in +, not backticks, in sdocclaudiob2014-11-201-3/+3
| | | | | | | | [ci skip]
* | edit pass over all warningsXavier Noria2014-10-281-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uniformizes warning messages. I used the most common style already present in the code base: * Capitalize the first word. * End the message with a full stop. * "Rails 5" instead of "Rails 5.0". * Backticks for method names and inline code. Also, converted a few long strings into the new heredoc convention.
* | Fix typo in actionpack/lib/action_dispatch/routing/mapper.rbYuutetu2014-10-161-1/+1
| |
* | Don't ignore constraints in redirect routesAgis-2014-08-251-2/+0
| | | | | | | | | | | | | | | | https://github.com/rails/rails/commit/402c2af55053c2f29319091ad21fd6fa6b90ee89 introduced a regression that caused any constraints added to redirect routes to be ignored. Fixes #16605
* | ask the scope object if it is a resource_method_scopeAaron Patterson2014-08-131-10/+13
| |
* | ask the scope for the action nameAaron Patterson2014-08-131-14/+18
| |
* | reduce calls to scope_levelAaron Patterson2014-08-131-1/+5
| | | | | | | | | | this will help us to encapsulate magical symbols so hopefully we can eliminate hardcoded magic symbols
* | change to attr_readerAaron Patterson2014-08-131-5/+1
| |
* | scope_level is no longer a hash key, just use the ivarAaron Patterson2014-08-131-4/+9
| |
* | move the scope level key fully inside the scope objectAaron Patterson2014-08-131-1/+5
| |
* | move scope_level to a method on the scope objectAaron Patterson2014-08-131-7/+20
| | | | | | | | now we don't have to have a hard coded key
* | only look up scope level onceAaron Patterson2014-08-131-6/+7
| | | | | | | | avoid hash lookups and remove depency on the instance
* | only test `prefix` onceAaron Patterson2014-08-131-2/+4
| | | | | | | | we don't need to repeat if statements
* | pass consistent parameters to canonical_action?Aaron Patterson2014-08-131-5/+5
| | | | | | | | | | now we only have to look up @scope[:scope_level] once per call to canonical_action? and we don't have a variable named "flag"
* | fewer operations on the options hashAaron Patterson2014-08-131-10/+10
| | | | | | | | | | since we pass `as` down, then we won't have to do an insert / delete dance with the options hash
* | always return a string from find_script_nameAaron Patterson2014-08-011-5/+7
| | | | | | | | this allows us to avoid nil checks on the return value
* | use `get` instead of accessing the named routes internalsAaron Patterson2014-07-311-1/+1
| |
* | invert check so we fail fasterAaron Patterson2014-07-311-1/+1
| | | | | | | | | | there's no reason to to_sym the string if it doesn't match the regexp anyway
* | do a hash lookup for collision detectionAaron Patterson2014-07-311-1/+1
| | | | | | | | hash lookup should be faster than searching an array.
* | push options inside the scope objectAaron Patterson2014-07-301-4/+9
| |
* | turn scope in to a linked listAaron Patterson2014-07-301-15/+36
| | | | | | | | this makes scope rollback much easier
* | remove the mounted? methodAaron Patterson2014-07-281-1/+1
| | | | | | | | | | we know the routes should not be "optimized" when mounting an application
* | push rails app testing upAaron Patterson2014-07-161-9/+13
| | | | | | | | this way we only have to test for whether it is a rails app once.
* | Rails-ish apps should descend from Rails::RailtieAaron Patterson2014-07-161-8/+3
| | | | | | | | | | Use an is_a check to ensure it's a Railsish app so we can avoid respond_to calls everywhere.
* | app should always be a class (I suppose)Aaron Patterson2014-07-161-1/+1
| |
* | we should be checking if the app is a classAaron Patterson2014-07-161-1/+1
| | | | | | | | | | Hopefully `object.class` always returns something that is_a?(Class), so the previous logic didn't really make sense.
* | routed applications will respond to these methodsAaron Patterson2014-07-151-1/+1
| |
* | RouteSet should be in charge of constructing the dispatherAaron Patterson2014-07-151-8/+9
| | | | | | | | Now we can override how requests are dispatched in the routeset object
* | Generate shallow paths for all children of shallow resources.Seb Jacobs2014-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this commit shallow resources would only generate paths for non-direct children (with a nested depth greater than 1). Take the following routes file. resources :blogs do resources :posts, shallow: true do resources :comments do resources :tags end end end This would generate shallow paths for `tags` nested under `posts`, e.g `/posts/:id/tags/`, however it would not generate shallow paths for `comments` nested under `posts`, e.g `/posts/:id/comments/new`. This commit changes the behaviour of the route mapper so that it generate paths for direct children of shallow resources, for example if you take the previous routes file, this will now generate shallow paths for `comments` nested under `posts`, .e.g `posts/:id/comments/new`. This was the behaviour in Rails `4.0.4` however this was broken in @jcoglan's fix for another routes related issue[1]. This also fixes an issue[2] reported by @smdern. [1] https://github.com/rails/rails/commit/d0e5963 [2] https://github.com/rails/rails/issues/15783
* | Fix doc unwanted dl Admin:: [ci skip]Ciro Santilli2014-07-011-1/+1
|/
* push splitting "to" up the callstackAaron Patterson2014-06-031-15/+20
|
* Routes specifying 'to:' must be a string that contains a "#" or a rackAaron Patterson2014-06-031-3/+21
| | | | | application. Use of a symbol should be replaced with `action: symbol`. Use of a string without a "#" should be replaced with `controller: string`.
* push some options munging to an alternate constructorAaron Patterson2014-06-031-13/+19
|
* move options_constraints tests next to each otherAaron Patterson2014-06-031-2/+2
|
* only do is_a checks on `formatted` onceAaron Patterson2014-06-031-9/+5
|
* push options_constraints processing upAaron Patterson2014-06-031-22/+24
| | | | | this lets us reduce is_a checks on the options_constraints and push "callable constraints" verification to the right place.
* remove options as an ivarAaron Patterson2014-06-031-6/+8
|
* only do Regexp === option onceAaron Patterson2014-06-031-3/+4
|
* return early from add_request_methodAaron Patterson2014-06-031-11/+11
|
* only loop over `options` once (hopefully)Aaron Patterson2014-06-031-13/+11
|