|
327 | 327 | url = node.arguments.first.to_value
|
328 | 328 | hash_node = node.arguments.last
|
329 | 329 | if hash_node.type == :hash && hash_node.key?(:controller)
|
330 |
| - if hash_node.key?(:action) || url !~ /:action/ |
331 |
| - controller_action_name = |
332 |
| - if hash_node.key?(:action) |
333 |
| - extract_controller_action_name(hash_node) |
334 |
| - else |
335 |
| - "#{hash_node.hash_value(:controller).to_value}#index" |
336 |
| - end |
337 |
| - method = extract_method(hash_node) |
338 |
| - subdomain_node = extract_subdomain_node(hash_node) |
339 |
| - other_options_code = reject_keys_from_hash(hash_node, :controller, :action, :method, :conditions) |
340 |
| - other_options_code += ":constraints => {:subdomain => #{subdomain_node.to_source}}" if subdomain_node |
341 |
| - if other_options_code.length > 0 |
342 |
| - replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", #{other_options_code}, :as => \"#{message}\"" |
| 330 | + if hash_node.key?(:action) || url !~ /:action/ |
| 331 | + controller_action_name = |
| 332 | + if hash_node.key?(:action) |
| 333 | + extract_controller_action_name(hash_node) |
343 | 334 | else
|
344 |
| - replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", :as => \"#{message}\"" |
| 335 | + "#{hash_node.hash_value(:controller).to_value}#index" |
345 | 336 | end
|
| 337 | + method = extract_method(hash_node) |
| 338 | + subdomain_node = extract_subdomain_node(hash_node) |
| 339 | + other_options_code = reject_keys_from_hash(hash_node, :controller, :action, :method, :conditions) |
| 340 | + other_options_code += ":constraints => {:subdomain => #{subdomain_node.to_source}}" if subdomain_node |
| 341 | + if other_options_code.length > 0 |
| 342 | + replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", #{other_options_code}, :as => \"#{message}\"" |
346 | 343 | else
|
347 |
| - replace_with 'match {{arguments}}' |
| 344 | + replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", :as => \"#{message}\"" |
348 | 345 | end
|
| 346 | + else |
| 347 | + replace_with 'match {{arguments}}' |
349 | 348 | end
|
| 349 | + end |
350 | 350 | end
|
351 | 351 | end
|
352 | 352 | end
|
|
0 commit comments