spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
815 stars 256 forks source link

Fix bug with external asset host #246

Closed PatrickMcSweeny closed 6 years ago

PatrickMcSweeny commented 6 years ago

The first line of the conditional in the normalize_host function will always return false because if the regular expression matches it will return 0 which evaluates to false. This pull request fixes the issue by using the present? method which will reliably evaluate to true when the regex matches.

spohlenz commented 6 years ago

0 is a truthy value in Ruby, so if you are seeing a bug with external asset hosts, I don't think it is because of this.

PatrickMcSweeny commented 6 years ago

I was having trouble using this gem with an external asset host because it kept trying to prefix the host name with a "//". I was able to fix this problem by forking the repo, changing that single line and then pointing to my forked gem in the application's Gemfile.

spohlenz commented 6 years ago

What is your Rails.application.config.action_controller.asset_host set to? Let's see if we can get to the bottom of this.

PatrickMcSweeny commented 6 years ago

This no longer seems to be an issue.