Skip to content

Commit

Permalink
Update polymorphic_path implementation to match parameters of Rails…
Browse files Browse the repository at this point in the history
…' original method.
  • Loading branch information
anaulin committed Oct 19, 2023
1 parent 8f8b4df commit 2a630e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ class ApplicationController < ActionController::Base

# Removes the root branded domain from the path builder
# @see http://api.rubyonrails.org/classes/ActionDispatch/Routing/PolymorphicRoutes.html#method-i-polymorphic_path
helper_method def polymorphic_path(options, **attributes)
if options[0].try(:branded_domain).present? && options.length > 1
options.delete_at(0)
elsif [:edit, :new].include?(options[0]) && options.try(:branded_domain).present?
helper_method def polymorphic_path(record_or_hash_or_array, options = {})
if record_or_hash_or_array[0].try(:branded_domain).present? && record_or_hash_or_array.length > 1
record_or_hash_or_array.delete_at(0)
elsif [:edit, :new].include?(record_or_hash_or_array[0]) && record_or_hash_or_array.try(:branded_domain).present?
options.delete_at(1)
end

Expand Down

0 comments on commit 2a630e9

Please sign in to comment.