I set up facebooker to tunnel my Ruby on Rails application.
The issue is that I would like to test locally. That is, I don't want to have to start a tunnel every time I want to see my changes.
Right now, when I start the application using ruby script/server
(not calling rake facebooker:tunnel:background_start
beforehand), links created by helpers (e.g., stylesheet_link_tag, javascript_include_tag, image_tag) are prepended with my tunnlr address: http://web1.tunnlr.com:myPort/. (For example, a CSS link looks like this in the page source: http://web1.tunnlr.com:myPort//stylesheets/appName.css?1234567890.)
I don't want that functionality; I can't see my CSS or JavaScript changes without having to start the tunnel first. I want the links to be relative, not absolute. So, stylesheet_link_tag
should produce /stylesheets/appName.css?1234567890
.
Does anyone know why it's doing that in the first place and how to fix it?
Thanks in advance.
The AssetTagHelper uses your asset_host
URL. I am not sure whether facebooker
is setting it for you (I don't know much about facebooker), but you can reset it in your view no problem:
Before your stylesheet_link_tab
just override the host URL:
ActionController::Base.asset_host = "localhost:3000"
# or
ActionController::Base.asset_host = ""
So using ERB it might look like this:
<% ActionController::Base.asset_host = "" %>
<%= stylesheet_link_tag "stylesheet.css" %>
Walabing!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With