diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2010-03-15 09:45:29 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-03-15 09:45:29 -0500 |
commit | 96bc6bcfee704701de1a9c4c3c6a7c265610d34d (patch) | |
tree | 2abfc8ca7811643738de52bd3ebd4224bc774c27 /actionpack/lib | |
parent | 16572fd46e189d80c6be7d499e687fe129053a2c (diff) | |
download | rails-96bc6bcfee704701de1a9c4c3c6a7c265610d34d.tar.gz rails-96bc6bcfee704701de1a9c4c3c6a7c265610d34d.tar.bz2 rails-96bc6bcfee704701de1a9c4c3c6a7c265610d34d.zip |
Don't force singularization of singleton resource names, e.g. /preferences [#4089 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 0b7b09ee7a..f9b27a5a03 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -362,11 +362,11 @@ module ActionDispatch attr_reader :plural, :singular, :options def initialize(entities, options = {}) - entities = entities.to_s + @name = entities.to_s @options = options - @plural = entities.pluralize - @singular = entities.singularize + @plural = @name.pluralize + @singular = @name.singularize end def default_actions @@ -393,7 +393,7 @@ module ActionDispatch end def name - options[:as] || plural + options[:as] || @name end def controller @@ -438,8 +438,8 @@ module ActionDispatch end end - def name - options[:as] || singular + def member_name + name end end @@ -468,8 +468,8 @@ module ActionDispatch post :create if resource.actions.include?(:create) put :update if resource.actions.include?(:update) delete :destroy if resource.actions.include?(:destroy) - get :new, :as => resource.singular if resource.actions.include?(:new) - get :edit, :as => resource.singular if resource.actions.include?(:edit) + get :new, :as => resource.name if resource.actions.include?(:new) + get :edit, :as => resource.name if resource.actions.include?(:edit) end end |