Sorry for the question, as I'm a ruby and rails novice. How do I get the asset pipeline working on rails?
In my development enviroment I have this individual files of javascript and they are loaded normally in site/app/views/stats/index.html.erb:
<%= javascript_include_tag "/assets/jquery.js" %>
<%= javascript_include_tag "/assets/stats/donut.js" %>
<%= javascript_include_tag "/assets/stats/vbars.js" %>
<%= javascript_include_tag "/assets/stats/progress.js" %>
<%= javascript_include_tag "/assets/stats/gauge.js" %>
<%= javascript_include_tag "/assets/stats/hbars.js" %>
<%= javascript_include_tag "/assets/stats/widget_grid.js" %>
<%= javascript_include_tag "/assets/stats/widget.js" %>
In production enviroment it is not working. So I'm trying to get developer enviroment to use asset pipeline. Here's what I got so far:
In site/config/enviroment/development.rb I configured
config.assets.debug = false
config.assets.compile = false
config.assets.digest = true
Then stopped my rails server and ran
bundle exec rake assets:precompile
and restarted the rails server.
Then in site/app/views/stats/index.html.erb I just replaced the javascript includes for
<%= javascript_include_tag "stats" %>
and created a site/app/assets/javascripts/stats.js file that contains
//= require stats/donut
//= require stats/vbars
//= require stats/progress
//= require stats/gauge
//= require stats/hbars
//= require stats/widget_grid
//= require stats/widget
What am I doing wrong? Any help is appreciated.
Update: problem was happening because I forgot to include a third-party library inside stats.js. Originally had this include in site/app/views/stats/index.html.erb
<%= javascript_include_tag "/assets/third-party/d3.min.js" %>
Just had to remove that include and add this one to stats.js
//= require third-party/d3.min.js
Thanks for everybody who helped!