我遇到了麻烦,我有一个应用程序,有些观点使用javascripts,我使用了jammit gem。
我添加了一个新的javascript来排序和过滤记录,问题是,在开发中工作,但是在生产中工作。
我尝试了一些事情,例如,如果改变这一行:
config.serve_static_assets = false
代表
config.serve_static_assets = true
有效,但我不是为了javascript工作而这样做,因为已经在应用程序中存在其他javascripts。
其他测试,我复制了public / javascripts / datatables.js中的assets / datatables.js中的行,在开发工作和生产中没有。
的Gemfile
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
enviroments / production.rb
...
config.serve_static_assets = false
...
视图/ user_reports / index.html.erb
<%= include_javascripts :datatables %>
我不知道= /
PS:对不起英语
UPDATED 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>'