Hi all,
I’ve got my first POC jruby-rails app going under Tomcat! I find this
very
rad. Although I do have one small problem: while my webapp is deploying
on
tomcat correctly, it would seem that the URLs generated by the asset
helpers
in Rails don’t match anything Tomcat has configured. So, while my Rails
app
is at:
localhost:8080/myapp/
localhost:8080/myapp/posts etc and so forth
The URLs for my javascripts and stylesheets are still off the /
resource:
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag ‘rails.js’, :cache => true %>
<%= javascript_include_tag ‘application.js’ %>
Yields:
It’s obvious why this isn’t working, they need to be loaded via
/myapp/stylesheets/* and /myapp/javascripts/*
What’s the common way to work around this? Some kind of resource mapping
in
web.xml? Ideally, they should load correctly when I run the Rails app by
itself (script/server) or when I deploy to Tomcat, but perhaps that’s
not
realistic.
Thanks for any advice, and please forgive me if I’ve overlooked a
previous
discussion of this, I was unable to find what I was looking for by
searching
the list.
Regards,
Billy
Hi Billy,
On Thu, Aug 12, 2010 at 9:24 AM, Billy G. [email protected] wrote:
<%= javascript_include_tag ‘rails.js’, :cache => true %>
What’s the common way to work around this? Some kind of resource mapping in
web.xml? Ideally, they should load correctly when I run the Rails app by
itself (script/server) or when I deploy to Tomcat, but perhaps that’s not
realistic.
Thanks for any advice, and please forgive me if I’ve overlooked a previous
discussion of this, I was unable to find what I was looking for by searching
the list.
What version of Rails, Tomcat, Warbler and JRuby-Rack do you have?
This used to be adjusted automatically, but either I introduced a
regression or Rails doesn’t use the setting I relied upon anymore. The
best workaround for now is to set
config.action_controller.asset_host = ‘/myapp’
in config/environments/production.rb.
/Nick
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Thu, Aug 12, 2010 at 10:28 AM, Nick S. [email protected]
wrote:
in Rails don’t match anything Tomcat has configured. So, while my Rails
rel=“stylesheet” type=“text/css” />
realistic.
Hi Nick,
Thanks for the help! Can do. Right now I’m working with tomcat 6.0.29,
jruby-rack 1.0.2, rails 3.0.0.rc, warbler 1.2.0.
That bit about making the mod in production.rb leads me to another query
am I correct in assuming that the deploy to tomcat is always going to be
with “production” Rails ENV?
Thanks!
On Thu, Aug 12, 2010 at 9:41 AM, Billy G. [email protected] wrote:
tomcat correctly, it would seem that the URLs generated by the asset
<%= javascript_include_tag ‘application.js’ %>
in
What version of Rails, Tomcat, Warbler and JRuby-Rack do you have?
This used to be adjusted automatically, but either I introduced a
regression or Rails doesn’t use the setting I relied upon anymore. The
best workaround for now is to set
config.action_controller.asset_host = ‘/myapp’
in config/environments/production.rb.
Hi again Billy,
I looked into this and found I wasn’t propagating a setting in
JRuby-Rack. If you “gem install jruby-rack” you should now get 1.0.3,
and this issue should be fixed, and you won’t need the asset_host
workaround.
Cheers,
/Nick
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Aug 12, 2010, at 09:41 , Billy G. wrote:
localhost:8080/myapp/
<script src="/javascripts/application.js?1281564066"
Hi Nick,
Thanks for the help! Can do. Right now I’m working with tomcat 6.0.29, jruby-rack 1.0.2, rails 3.0.0.rc, warbler 1.2.0.
That bit about making the mod in production.rb leads me to another query – am I correct in assuming that the deploy to tomcat is always going to be with “production” Rails ENV?
That’s correct.
/Nick
Works like a charm, sir! Thanks.