Macrow / rails_kindeditor

Kindeditor for Ruby on Rails
260 stars 108 forks source link

从0.3.14版本升级后,出现加载不到/assets/themes/default/default.css的错误 #50

Closed xyzren closed 10 years ago

xyzren commented 11 years ago

昨天把gem从0.3.14进行了升级,从浏览器访问时发现有两个资源加载不到,一个是“assets/themes/default/default.css”,另外个是“/assets/lang/zh_CN.js?ver=4.1.7%20(2013-04-21)”。 有两个疑问,第一个是浏览器请求的资源文件从命令上看是没有precompile的?第二个是访问的路径貌似不对,服务器上这两文件的路径是在"/assets/kindeditor/"这个目录下面。

Macrow commented 11 years ago

你的Rails版本是4.0吗?

从Rails 4.0开始, precompiling assets不再自动从vendor/assets和lib/assets拷贝非JS/CSS文件. 参见 https://github.com/rails/rails/pull/7968 如果要使用Rails 4.0的生产模式,请运行'rake kindeditor:assets', 此方法可将kindeditor自动拷贝到你的public/assets目录.

  rake kindeditor:assets
Macrow commented 10 years ago

目前没有更多反馈,此问题暂时关闭。

jerryshen commented 10 years ago

GET http://localhost:3000/assets/active_admin/kindeditor/themes/default/default.css 404 (Not Found) kindeditor.js?body=1:4456 GET http://localhost:3000/assets/active_admin/kindeditor/lang/zh_CN.js?ver=4.1.9%20(2013-10-08) 404 (Not Found)

jerryshen commented 10 years ago

I got this problem based on development mode.

Macrow commented 10 years ago

加载kindeditor的时候是依赖application.js来计算的,所以请在application.js里申明加载kindeditor。

jerryshen commented 10 years ago

activeadmin用的是activeadmin.js.coffee这个js. 然后我把kindeditor加载在这个js中就会出现这个问题

Macrow commented 10 years ago

之前考虑到assets host的情况,计算引用路径有点问题,目前进行了修正:https://github.com/Macrow/rails_kindeditor/commit/5f8901ef915019aff1e40f16ed6956328a6ae35a

你可以先用这么使用:

gem 'rails_kindeditor', github: 'Macrow/rails_kindeditor'