diff options
author | Mike Gunderloy <MikeG1@larkfarm.com> | 2009-03-11 08:08:09 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-12 17:02:07 +0000 |
commit | d771e7d17f4a2c175676f7c8354aa5b161b63c2e (patch) | |
tree | 98dd03911df028c4ff4cbde1d3e0a11cd39d4868 /actionpack/lib | |
parent | 3c64c9a5756193247ac87bb55326b6387dfd3070 (diff) | |
download | rails-d771e7d17f4a2c175676f7c8354aa5b161b63c2e.tar.gz rails-d771e7d17f4a2c175676f7c8354aa5b161b63c2e.tar.bz2 rails-d771e7d17f4a2c175676f7c8354aa5b161b63c2e.zip |
Handle irregular plurals in polymorphic_urls [#2212 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/polymorphic_routes.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/polymorphic_routes.rb b/actionpack/lib/action_controller/polymorphic_routes.rb index 924d1aa6bd..d9b614c237 100644 --- a/actionpack/lib/action_controller/polymorphic_routes.rb +++ b/actionpack/lib/action_controller/polymorphic_routes.rb @@ -163,7 +163,8 @@ module ActionController if parent.is_a?(Symbol) || parent.is_a?(String) string << "#{parent}_" else - string << "#{RecordIdentifier.__send__("singular_class_name", parent)}_" + string << "#{RecordIdentifier.__send__("plural_class_name", parent)}".singularize + string << "_" end end end @@ -171,7 +172,9 @@ module ActionController if record.is_a?(Symbol) || record.is_a?(String) route << "#{record}_" else - route << "#{RecordIdentifier.__send__("#{inflection}_class_name", record)}_" + route << "#{RecordIdentifier.__send__("plural_class_name", record)}" + route = route.singularize if inflection == :singular + route << "_" end action_prefix(options) + namespace + route + routing_type(options).to_s |