Last active
March 11, 2021 21:39
-
-
Save corporealfunk/599fa99c52750508f997dec6e7be2f25 to your computer and use it in GitHub Desktop.
Force SpinaCMS admin panel to not inject the host:port into the urls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SpinaCMS will inject image URLs into the Trix content with the host:port as part of the URL | |
# This makes it hard to port that DB content to another host (say move from localhost to a production or staging site) | |
# load this patch from the config/application.rb like so:https://guides.rubyonrails.org/engines.html#overriding-models-and-controllers | |
Spina::ImagesHelper.class_eval do | |
def embedded_image_url(image) | |
return "" if image.nil? | |
main_app.polymorphic_path(image.variant(resize: Spina.config.embedded_image_size), only_path: true) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment