aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2010-01-13 12:18:06 -0600
committerJoshua Peek <josh@joshpeek.com>2010-01-13 12:18:06 -0600
commitbf9b81e2cbfd4333f0b813ac07ea9d9c982e7779 (patch)
tree2277c8f601e1116142b39cb5ae209f29b4c47557 /actionpack/lib/action_dispatch/routing/mapper.rb
parent521ef3c40f34d61d42d092eb39348a1be52ac57d (diff)
downloadrails-bf9b81e2cbfd4333f0b813ac07ea9d9c982e7779.tar.gz
rails-bf9b81e2cbfd4333f0b813ac07ea9d9c982e7779.tar.bz2
rails-bf9b81e2cbfd4333f0b813ac07ea9d9c982e7779.zip
Pass :as to resources to change the resource name
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index e283cf0403..48fb7edd67 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -328,13 +328,14 @@ module ActionDispatch
def initialize(entities, options = {})
entities = entities.to_s
+ @options = options
@plural = entities.pluralize
@singular = entities.singularize
end
def name
- plural
+ @options[:as] || plural
end
def controller
@@ -360,7 +361,7 @@ module ActionDispatch
end
def name
- singular
+ @options[:as] || singular
end
end
@@ -373,7 +374,7 @@ module ActionDispatch
return self
end
- resource = SingletonResource.new(resources.pop)
+ resource = SingletonResource.new(resources.pop, options)
if @scope[:scope_level] == :resources
nested do
@@ -407,7 +408,7 @@ module ActionDispatch
return self
end
- resource = Resource.new(resources.pop)
+ resource = Resource.new(resources.pop, options)
if @scope[:scope_level] == :resources
nested do