1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Seperate scope level for nesting resources

This commit is contained in:
Joshua Peek 2009-12-08 16:06:46 -06:00
parent 33658ea1ae
commit c4df6332a4

View file

@ -291,10 +291,8 @@ module ActionDispatch
resource = SingletonResource.new(resources.pop)
if @scope[:scope_level] == :resources
with_scope_level(:member) do
scope(parent_resource.id_segment, :name_prefix => parent_resource.member_name) do
resource(resource.name, options, &block)
end
nested do
resource(resource.name, options, &block)
end
return self
end
@ -329,10 +327,8 @@ module ActionDispatch
resource = Resource.new(resources.pop)
if @scope[:scope_level] == :resources
with_scope_level(:member) do
scope(parent_resource.id_segment, :name_prefix => parent_resource.member_name) do
resources(resource.name, options, &block)
end
nested do
resources(resource.name, options, &block)
end
return self
end
@ -387,6 +383,18 @@ module ActionDispatch
end
end
def nested
unless @scope[:scope_level] == :resources
raise ArgumentError, "can't use nested outside resources scope"
end
with_scope_level(:nested) do
scope(parent_resource.id_segment, :name_prefix => parent_resource.member_name) do
yield
end
end
end
def match(*args)
options = args.extract_options!