diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-01 16:16:03 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-01 16:16:15 -0800 |
commit | 4cfa10cda5e5088eabce10cef0623e2b2a9c40dd (patch) | |
tree | 13bcc1c6e17a7aac02c1826d59951e6a33e68fcc /actionpack/lib | |
parent | 95c76a7cf390d5c01207757b7b2487e289c41b3d (diff) | |
download | rails-4cfa10cda5e5088eabce10cef0623e2b2a9c40dd.tar.gz rails-4cfa10cda5e5088eabce10cef0623e2b2a9c40dd.tar.bz2 rails-4cfa10cda5e5088eabce10cef0623e2b2a9c40dd.zip |
refactor `handle_model` to use private helper methods for generation
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 1a7944780b..9934f5547a 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -247,14 +247,12 @@ module ActionDispatch args = [] model = record.to_model - name = if model.persisted? - args << model - model.model_name.singular_route_key - else - @key_strategy.call model.model_name - end - - named_route = get_method_for_string name + named_route = if model.persisted? + args << model + get_method_for_string model.model_name.singular_route_key + else + get_method_for_class model + end [named_route, args] end |