In my project, I have tried to bundle most of my js libraries into gems so they can be updated and pulled in whenever necessary, however, I've recently setup our production server and I'm having issues with asset compilation and static assets in /public/assets.
Specifically, when I don't use the asset pipeline, I have no issues with datatables or any other JS libraries or css that I am trying to use. I am precompiling my assets in production and using a typical nginx setup (based on railscast #335) to serve them.
Static assets are the following -
public/assets
javascript/jquery.formatCurrency-1.4.0.min.js
stylesheets/datepicker.css
twitter/bootstrap/bootstrap-datepicker.js
is public/assets the correct place for these?
When I deploy with capistrano, these assets get a 404 when loading the page and are not actually copied to the /public/assets directory on the server.
When loading other pages I am calling the datatables plugin as follows
$('#inventory_item_list_datatable').dataTable
sDom: "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
sPaginationType: "bootstrap",
iDisplayLength: 100
Datatables is compiled into my application.js and doesn't throw an error, but the table never actually renders. I'm wondering if this is related to the order that everything is compiled?
app/assets/javascripts/application.js
//= require jquery
//= require jquery_ujs
//= require jquery_nested_form
//= require twitter/bootstrap
//= require dataTables/jquery.dataTables
//= require dataTables/jquery.dataTables.bootstrap
//= require_tree .
app/views/layouts/application.html.erb
<%= stylesheet_link_tag "application", :media => "all" %>
<link href="/assets/stylesheets/datepicker.css" media="all" rel="stylesheet" type="text/css" />
<%= javascript_include_tag "application" %>
<script src="/assets/twitter/bootstrap/bootstrap-datepicker.js" type="text/javascript"></script>
---edit datatables issue
when using jquery-datatables-rails gem it must be OUTSIDE of your assets group in gemfile.