diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-13 18:47:16 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-13 18:47:16 -0700 |
commit | 91608dc342237372548ccbe403ef06c56c2755f2 (patch) | |
tree | 2da30114397569714c6a34dafe50a49240cebc20 /actionpack/lib/action_dispatch/routing | |
parent | 318eea062ec3aa95929cfb516a273e732e22a9d1 (diff) | |
download | rails-91608dc342237372548ccbe403ef06c56c2755f2.tar.gz rails-91608dc342237372548ccbe403ef06c56c2755f2.tar.bz2 rails-91608dc342237372548ccbe403ef06c56c2755f2.zip |
only test `prefix` once
we don't need to repeat if statements
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index a3a22bceb1..37f781a7dd 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1732,12 +1732,14 @@ module ActionDispatch elsif !canonical_action?(action, @scope[:scope_level]) prefix = action end - prefix.to_s.tr('-', '_') if prefix + + if prefix + Mapper.normalize_name prefix.to_s.tr('-', '_') + end end def name_for_action(as, action) #:nodoc: prefix = prefix_name_for_action(as, action) - prefix = Mapper.normalize_name(prefix) if prefix name_prefix = @scope[:as] if parent_resource |