1

我将一个 Rails 2.2.2 站点移到 Rails 3 并一直在修复它。我现在进入网站的 JS 部分,当我点击包含 JS 的页面时看到以下内容:

在此处输入图像描述

这可能是级联问题吗?- 在 effects.js 之前加载了 controls.js 我认为 Rails 会以某种方式处理这个问题?

这是加载 JS 的顺序:

Started GET "/assets/jquery.js?body=1"
Served asset /jquery.js - 200 OK (0ms)


Started GET "/assets/jquery-ui.js?body=1"
Served asset /jquery-ui.js - 200 OK (0ms)


Started GET "/assets/jquery.alerts.js?body=1"
Served asset /jquery.alerts.js - 200 OK (0ms)


Started GET "/assets/jquery_ujs.js?body=1"
Served asset /jquery_ujs.js - 200 OK (0ms)


Started GET "/assets/admin.js?body=1"
Served asset /admin.js - 200 OK (0ms)


Started GET "/assets/controls.js?body=1"
Served asset /controls.js - 200 OK (0ms)


Started GET "/assets/dragdrop.js?body=1"
Served asset /dragdrop.js - 200 OK (0ms)


Started GET "/assets/effects.js?body=1"
Served asset /effects.js - 200 OK (0ms)


Started GET "/assets/jquery.validate.min.js?body=1"
Served asset /jquery.validate.min.js - 200 OK (0ms)


Started GET "/assets/prototype.js?body=1"
Served asset /prototype.js - 200 OK (0ms)


Started GET "/assets/application.js?body=1"
Served asset /application.js - 200 OK (3ms)


Started GET "/assets/jquery-ui.css?body=1"
Served asset /jquery-ui.css - 200 OK (0ms)


Started GET "/assets/jquery.alerts.css?body=1"
Served asset /jquery.alerts.css - 200 OK (0ms)


Started GET "/assets/default.css?body=1"
Served asset /default.css - 200 OK (0ms)


Started GET "/assets/jquery.js?body=1"
Served asset /jquery.js - 200 OK (0ms)


Started GET "/assets/jquery-ui.js?body=1"
Served asset /jquery-ui.js - 200 OK (0ms)

文件application.js如下所示:

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

我怎样才能解决这个问题?

非常感谢!

/应用程序/资产/javascript

在此处输入图像描述

4

1 回答 1

0

您需要在 application.js 中指定加载顺序:

//= require jquery
//= require jquery_ujs
//= require prototype/prototype
//= require prototype/effects
//= require prototype/dragdrop
//= require prototype/controls
//= require_tree .
于 2013-04-24T11:43:26.587 回答