1
votes

I've recently switched my app over to Rails 3.1 and began using the asset pipeline. All of my scripts get compiled into application.js in production, however not all of the scripts are working. For example, if you check out http://photoramblr.com/assets/application.js and search for "twipsy" you'll see it's in there, but it's not working. On the home page, mousing over images should bring up tool-tips. This works fine in development, but not in production.

My app is served on a Cedar stack on Heroku.

layouts/application.html.erb

<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>

application.js

//= require jquery
//= require jquery_ujs
//= require_self
//= require_tree .

environments/production.rb

config.serve_static_assets = true
config.static_cache_control = "public, max-age=86400"
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true

application.rb

require 'rails/all'

if defined?(Bundler)
  Bundler.require *Rails.groups(:assets => %w(development test))
  # Bundler.require(:default, :assets, Rails.env)
end

I'm also using another script for an image viewer called "TN3" which is also getting compiled in, but is not working in production. The stylesheet is getting compiled and works just fine. Has anyone experienced anything like this?

Update

I've also just run the rake assets:precompile suggested by Heroku and still getting the same result...

2

2 Answers

2
votes

Well, I was finally able to 'fix' this issue by specifying the files that needed to be loaded in my application.js file:

//= require bootstrap-twipsy
//= require jquery.tn3lite.min

I really don't understand why this is necessary when I have //= require_tree . in there as well, but apparently that wasn't doing the job... ?

0
votes

Check, below setting in config/environment/production.rb in your application It should be true

config.assets.compile = true

Please let me if it is not working for you