Merge pull request #10524 from mkllnk/dfc-urls

Configure host for dfc_provider engine globally
This commit is contained in:
Maikel
2023-03-08 11:13:48 +11:00
committed by GitHub
6 changed files with 1 additions and 9 deletions

View File

@@ -240,6 +240,7 @@ module Openfoodnetwork
config.generators.template_engine = :haml
Rails.application.routes.default_url_options[:host] = ENV["SITE_URL"]
DfcProvider::Engine.routes.default_url_options[:host] = ENV["SITE_URL"]
Rails.autoloaders.main.ignore(Rails.root.join('app/webpacker'))

View File

@@ -6,10 +6,6 @@ module DfcProvider
class BaseSerializer < ActiveModel::Serializer
private
def host
Rails.application.routes.default_url_options[:host]
end
def dfc_provider_routes
DfcProvider::Engine.routes.url_helpers
end

View File

@@ -17,7 +17,6 @@ module DfcProvider
dfc_provider_routes.enterprise_catalog_item_url(
enterprise_id: object.product.supplier_id,
id: object.id,
host: host
)
end
@@ -44,7 +43,6 @@ module DfcProvider
dfc_provider_routes.enterprise_supplied_product_url(
enterprise_id: object.product.supplier_id,
id: object.id,
host: host
)
end
end

View File

@@ -18,7 +18,6 @@ module DfcProvider
def id
dfc_provider_routes.enterprise_url(
id: object.id,
host: host
)
end

View File

@@ -30,7 +30,6 @@ module DfcProvider
def id
dfc_provider_routes.person_url(
id: object.id,
host: host
)
end

View File

@@ -20,7 +20,6 @@ module DfcProvider
dfc_provider_routes.enterprise_supplied_product_url(
enterprise_id: object.product.supplier_id,
id: object.id,
host: host
)
end