Skip to content

Commit

Permalink
Fixing path helpers in models other than the controllers (#1733)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolyncole authored Apr 3, 2024
1 parent 1f4e14e commit 7df1220
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
14 changes: 2 additions & 12 deletions app/decorators/work_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,12 @@ def wizard_mode?
def file_list_path
return work_file_list_path("NONE") if @work.nil? || !@work.persisted?

# This is a horrible hack to work-around the issue where Rails is not adding
# the correct prefix to the URL in production and staging.
if Rails.env.production? || Rails.env.staging?
"/describe" + work_file_list_path(@work.id)
else
work_file_list_path(@work.id)
end
work_file_list_path(@work.id)
end

def download_path
return if @work.nil? || !@work.persisted?

if Rails.env.production? || Rails.env.staging?
"/describe" + work_download_path(@work.id)
else
work_download_path(@work.id)
end
work_download_path(@work.id)
end
end
2 changes: 2 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@

ORCID_URL = "https://pub.orcid.org/v2.0"
ROR_URL = "https://api.ror.org/organizations"

Rails.application.routes.default_url_options[:relative_url_root] = "/describe"
2 changes: 2 additions & 0 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,5 @@

ORCID_URL = "https://pub.orcid.org/v2.0"
ROR_URL = "https://api.ror.org/organizations"

Rails.application.routes.default_url_options[:relative_url_root] = "/describe"

0 comments on commit 7df1220

Please sign in to comment.