diff options
author | José Valim <jose.valim@gmail.com> | 2009-08-01 15:29:39 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-08-07 17:16:15 +0200 |
commit | f59984cc81bd1a64a53a2480a9b4e05fe7357d7c (patch) | |
tree | 66e77bc67fb50cd5dccf19f41120aceab80f21b1 /actionpack/lib/action_controller/routing/generation | |
parent | c44f7e39f46058842845f8c95c3e49f7c59c3aad (diff) | |
download | rails-f59984cc81bd1a64a53a2480a9b4e05fe7357d7c.tar.gz rails-f59984cc81bd1a64a53a2480a9b4e05fe7357d7c.tar.bz2 rails-f59984cc81bd1a64a53a2480a9b4e05fe7357d7c.zip |
Add nagivational behavior to respond_with.
Diffstat (limited to 'actionpack/lib/action_controller/routing/generation')
-rw-r--r-- | actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb b/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb index 159d869a54..ee44160274 100644 --- a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb +++ b/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb @@ -86,17 +86,16 @@ module ActionController else [ record_or_hash_or_array ] end - inflection = - case - when options[:action].to_s == "new" - args.pop - :singular - when record.respond_to?(:new_record?) && record.new_record? - args.pop - :plural - else - :singular - end + inflection = if options[:action].to_s == "new" + args.pop + :singular + elsif (record.respond_to?(:new_record?) && record.new_record?) || + (record.respond_to?(:destroyed?) && record.destroyed?) + args.pop + :plural + else + :singular + end args.delete_if {|arg| arg.is_a?(Symbol) || arg.is_a?(String)} |