Rails 4 - 在生产中我的javascript加载,但不工作,而它在开发中工作良好 [英] Rails 4 - In production my javascript is loaded but does not work while it works well in development

查看:1119
本文介绍了Rails 4 - 在生产中我的javascript加载,但不工作,而它在开发中工作良好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用:


  • Rails版本4.2.3

  • Ruby版本2.2.1

我已经在生产环境中运行我的应用程序,执行以下步骤:

I have managed to run my application in production doing these steps :


  1. rake db:create RAILS_ENV = production

  2. = production

  3. rake assets:precompile rake assets:precompile RAILS_ENV =生产

  1. rake db:create RAILS_ENV=production
  2. rake db:migrate RAILS_ENV=production
  3. rake assets:precompile and rake assets:precompile RAILS_ENV=production



我在我的 application.js application.css 文件,因为所有的require都不在正确的顺序。我不得不在底部放置 require_tree ,在顶部放置 require jquery ,然后放置 require

I had some troubles with my application.js and application.css files because all the require were not in the right orders. I had to put require_tree at the bottom and require jquery at the top directly followed by require jquery_ujs.


现在我的档案如下:

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require dataTables/jquery.dataTables
//= require dataTables/extras/dataTables.tableTools
//= require_tree .



查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆