简体   繁体   中英

rails asset pipeline asset group not precompiling datatables

I started building a rails project that uses jquery-datatables-rails. When I put that into my Gemfile I did NOT put it into the assets group. Everything worked fine in development. When I went to put it into production I re-read the documentation and saw that it should be in the assets group so I moved that line in my Gemfile. Then I performed a rake assets:precompile and then ran rails server -e production.

The datatable doesn't work. In fact, the only way I can make it work is to take that line out of the assets group in my Gemfile and run in development mode. I've read a lot of conflicting information on the Internet about this.

Did I screw anything up by moving the line from outside the assets group into the assets group? I would like to be able to run this in production and I want to have a Gemfile that is consistent with the jquery-datatables-rails documentation.

A while back in response to a different problem that I was having, I moved require twitter/bootstrap above require jquery in app/assets/javascripts/application.js. As a result the javascript wasn't working right. Moving it into the right place solved the problem and inexplicably did not cause the old problem to return.

So the fix is, make sure that jquery is at the top of your application.js file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM