0

我遇到了麻烦,我有一个应用程序,一些视图使用 javascripts,我正在使用 jammit gem。

我添加了一个新的 javascript 来排序和过滤记录,问题是,在开发中工作,但在生产中不起作用。

我尝试了一些事情,例如,如果更改此行:

 config.serve_static_assets = false

为了

 config.serve_static_assets = true

作品,但我不这样做只是为了一个 javascript 作品,因为在 app.js 中已经存在其他 javascripts。

其他测试,我在 public/javascripts/datatables.js 的 cut 中复制了 assets/datatables.js 中的行,在开发工作和生产中没有。

宝石文件

gem 'jammit'

配置/assets.yml

...

package_assets: on
compress_assets: on
embed_assets: off

javascripts:
  common:
    - public/javascripts/jquery.js
    - public/javascripts/jquery-ui.js
    - public/javascripts/jquery_ujs.js
   ...

  datatables:
    - public/javascripts/jquery.dataTables.min.js

环境/生产.rb

...
config.serve_static_assets = false
...

意见/user_reports/index.html.erb

<%= include_javascripts :datatables %>

我不知道 =/

PS:对不起英文

更新 01

日志:

rake assets:precompile --trace RAILS_ENV=production
/usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.5.3/lib/bundler.rb:295: warning: Insecure world writable dir /usr/local in PATH, mode 040777

rake aborted!
Don't know how to build task 'assets:precompile'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in `[]'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:115:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-1.9.2-p290@base2_crowdtest/bin/ruby_executable_hooks:15:in `<main>'
4

0 回答 0