aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
Commit message (Collapse)AuthorAgeFilesLines
* drop || test for cases that do not need itAaron Patterson2014-05-131-1/+3
|
* extend with a module then use define_methodAaron Patterson2014-05-131-7/+4
| | | | no need for redefine_method
* Do not use short-circuit returnRafael Mendonça França2014-05-041-2/+3
|
* Merge pull request #11166 from xavier/callable_constraint_verificationRafael Mendonça França2014-05-041-0/+7
|\ | | | | | | | | | | | | Callable route constraint verification Conflicts: actionpack/CHANGELOG.md
| * Verify that route constraints respond to the expected messages instead of ↵Xavier Defrang2013-06-281-0/+7
| | | | | | | | silently failing to enforce the constraint
* | Tiny follow up to #14915 [ci skip]Robin Dupret2014-05-021-19/+18
| |
* | [skip ci] Document: required `via` option in `match` routing method.Juan David Pastas2014-04-301-20/+37
| |
* | Only make deeply nested routes shallow when parent is shallowAndrew White2014-04-111-1/+14
| | | | | | | | | | | | | | | | | | | | Since `:shallow` may be set at any point in the resource nesting we should only make the new and collection routes shallow when the parent is shallow. This is a bit of a hack but until the mapper is refactored to an object graph instead of a hash of merged values it's the best we can do. Fixes #14684.
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2014-03-291-0/+4
|\ \
| * | Mention required glob param name in match docs for mapperEarl St Sauver2014-03-201-0/+4
| | | | | | | | | | | | | | | | | | | | | THe match documentation doesn't mention any requirement of the parameter name requirement for matches. However, including a bare glob character without a variable assignment causes a parse error.
* | | Use nested_scope? not shallow? to determine whether to copy optionsAndrew White2014-03-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | The method `shallow?` returns false if the parent resource is a singleton so we need to check if we're not inside a nested scope before copying the :path and :as options to their shallow equivalents. Fixes #14388.
* | | Copy shallow options from normal options when using scopeAndrew White2014-03-081-1/+2
| | | | | | | | | | | | | | | | | | If the options :shallow_prefix and :shallow_path are not set in the scope options then copy them from the normal :as and :path options if they are set.
* | | Pull namespace defaults out of the options hashAndrew White2014-03-081-3/+10
| | | | | | | | | | | | | | | | | | | | | If a developer has specified either :path or :as in the options hash then these should be used as the defaults for :shallow_path and :shallow_prefix. Fixes #14241.
* | | Only use shallow nested scope when depth is > 1Andrew White2014-03-081-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | By tracking the depth of resource nesting we can push the need for nested shallow scoping to only those routes that are nested more than one deep. This allows us to keep the fix for #12498 and fix the regression in #14224. Fixes #14224.
* | | Move setting :scope_level_resource to resource_scopeAndrew White2014-03-081-7/+7
|/ / | | | | | | | | | | | | | | Originally with_scope_level was exclusively for managing scope levels with resources, however it is now used for other things so it makes more sense to move the responsibility for setting the :scope_level_resource to the resource_scope method. This eliminates repeatedly setting it to the same resource as each resource method scope is evaluated.
* | Set the :shallow_path as each scope is generatedAndrew White2014-02-091-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we set :shallow_path when shallow is called it can result in incorrect paths if the resource is inside a namespace because namespace itself sets the :shallow_path option to the namespace path. We fix this by removing the :shallow_path option from shallow as that should only be turning shallow routes on and not otherwise affecting the scope. To do this we need to treat the :shallow option to resources differently to other scope options and move it to before the nested block is called. This change also has the positive side effect of making the behavior of the :shallow option consistent with the shallow method. Fixes #12498.
* | Transform dashes to underscores in resource route namesByron Bischoff2014-01-251-4/+4
| | | | | | | | Fixes #13824
* | Automatically convert dashes to underscores in shorthand routesMikko Johansson2014-01-201-0/+1
| |
* | Automatically convert dashes to underscores for url helpersAmr Tamimi2014-01-201-1/+2
| |
* | Allow an absolute controller path inside a module scopeAndrew White2014-01-051-2/+6
| | | | | | | | Fixes #12777
* | Fix method redefined warning message in mapper.rbAndrew White2013-12-291-2/+3
| |
* | Fix mounting engines inside a resources blockPiotr Sarnacki2013-12-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a route is mounted inside a resources block, it's automatically prefixed, so a following code: resources :users do mount Blog::Engine => '/blog' end will generate a user_blog path helper. In order to access engine helpers, we also use "mounted_helpers", a list of helpers associated with each mounted engine, so a path to blog's post can be generated using user_blog.post_path(user, post). The problem I'm fixing here is that mount used a raw :as option, without taking nestings into account. As a result, blog was added to a route set as a `user_blog`, but helper was generated for just `blog`. This commit applies the proper logic for defining a helper for a mounted engine nested in resources or resource block. (closes #8533)
* | 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
|