diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-14 11:49:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-14 11:49:36 -0700 |
commit | 316ee25c25a64a2d82c284293a31804077b05d79 (patch) | |
tree | 4d3d6051f6edb291cd435b9d330b8e23fe56eb0f /actionpack/lib/action_dispatch/routing | |
parent | 09608ce9d236c6a9439cf011a3442e1492d0732e (diff) | |
parent | a1e2db2e9bb4ca2fdf6190aa8f448fe85cf76529 (diff) | |
download | rails-316ee25c25a64a2d82c284293a31804077b05d79.tar.gz rails-316ee25c25a64a2d82c284293a31804077b05d79.tar.bz2 rails-316ee25c25a64a2d82c284293a31804077b05d79.zip |
Merge branch 'master' into adequaterecord
* master: (70 commits)
[ci skip] Added link to ruby-lang.org installation.
Use the index on hidden field
`collection_check_boxes` respects `:index` option for the hidden filed name.
docs, double meaning of `serialize` argument. Closes #14284.
Just call read_attribute, no need to use `send`.
- Fix lingering reference to `:text` instead of the newer `:plain` - Section references `form_tag` instead of the `form_for` used in the example
again, read_attribute is public, so just call it
read_attribute is public, so we should just call it
Disable assest cache store in docs [ci skip]
Make counter cache decrementation on destroy idempotent
Write the failing test case for concurrent counter cache
[ci skip] Use plain underscore instead of "\_".
Update documentation to use Rails.application instead
Add a changelog entry for #14546 [ci skip]
Move tests for deep_dup and duplicable to object directory
Missing 'are' in note - [ci skip]
CollectionHelpers now accepts a readonly option
Fix a few typos [ci skip]
Bundle tzinfo-data on :x64_mingw (64-bit Ruby on Windows).
don't bother with an offset if the offset is zero
...
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6f0b49cf28..77718a14c1 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -995,6 +995,7 @@ module ActionDispatch @as = options[:as] @param = (options[:param] || :id).to_sym @options = options + @shallow = false end def default_actions @@ -1055,6 +1056,13 @@ module ActionDispatch "#{path}/:#{nested_param}" end + def shallow=(value) + @shallow = value + end + + def shallow? + @shallow + end end class SingletonResource < Resource #:nodoc: @@ -1361,7 +1369,7 @@ module ActionDispatch end with_scope_level(:nested) do - if shallow? && nesting_depth > 1 + if shallow? && shallow_nesting_depth > 1 shallow_scope(parent_resource.nested_scope, nested_options) { yield } else scope(parent_resource.nested_scope, nested_options) { yield } @@ -1576,6 +1584,7 @@ module ActionDispatch end def resource_scope(kind, resource) #:nodoc: + resource.shallow = @scope[:shallow] old_resource, @scope[:scope_level_resource] = @scope[:scope_level_resource], resource @nesting.push(resource) @@ -1600,6 +1609,10 @@ module ActionDispatch @nesting.size end + def shallow_nesting_depth #:nodoc: + @nesting.select(&:shallow?).size + end + def param_constraint? #:nodoc: @scope[:constraints] && @scope[:constraints][parent_resource.param].is_a?(Regexp) end |