我在我的应用程序中使用了一些gem,但是我遇到了一些问题。
在表单中,我使用gem cocoon创建嵌套字段,我也使用数据表来对列进行排序。
但这些宝石并非在生产中不起作用。
我把gem out资产组,我尝试使用:rake assets:precompile --trace之前执行应用程序,但仍然无法正常工作。
我的宝石文件:
source 'https://rubygems.org'
gem 'rails', '~> 3.2.16'
gem 'mysql2', '~> 0.3.14'
# Autenticação
gem 'authlogic', '~> 3.3.0'
# Autorização
gem 'cancan'
# Anexos
gem 'paperclip', '~> 3.0'
# Mailer
gem 'mail', '~> 2.5.4'
# Custom select
gem "bootstrap-select-rails", "~> 1.3.0"
#
gem 'whenever', :require => false
# Nested fields
gem 'cocoon'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '~> 1.0.3'
end
gem 'therubyracer', '~> 0.12.0'
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
gem 'less-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails', '~> 4.1.1'
# twitter bootstrap css & javascript toolkit
gem 'twitter-bootswatch-rails', '~> 3.0.3'
# twitter bootstrap helpers gem, e.g., alerts etc...
gem 'twitter-bootswatch-rails-helpers'
配置/ production.rb
Curriculum :: Application.configure do #此处指定的设置将优先于config / application.rb
中的设置 # Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Compress JavaScripts and CSS
config.assets.compile = true
#config.assets.precompile += %w( *.js *.css )
#config.serve_static_assets = true
config.assets.initialize_on_precompile = false
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
的application.js
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require jquery.ui.all
//= require jquery.ui.tabs
//= require jquery.ui.tabs.min
//= require bootstrap-tabs
//= require interns
//= require systems_analysts
//= require generics
//= require file_field
//= require bootstrap-filestyle
//= require dataTables/jquery.dataTables
//= require dataTables/jquery.dataTables.bootstrap
//= require cocoon
日志
=> Rails 3.2.16 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
[2014-02-04 11:08:45] INFO WEBrick 1.3.1
[2014-02-04 11:08:45] INFO ruby 1.9.3 (2013-06-27) [x86_64-linux]
[2014-02-04 11:08:45] INFO WEBrick::HTTPServer#start: pid=2567 port=3000
Started GET "/hr_curriculum_generics/new" for 127.0.0.1 at 2014-02-04 11:08:45 -0200
Processing by HrCurriculumGenericsController#new as HTML
Rendered shared/_error_messages.html.erb (0.7ms)
Rendered hr_curriculum_generics/_generic_company_fields.html.erb (2.0ms)
Rendered hr_curriculum_generics/_form.html.erb (144.0ms)
Rendered hr_curriculum_generics/new.html.erb within layouts/application (151.7ms)
Completed 200 OK in 382.1ms (Views: 286.4ms | ActiveRecord: 4.6ms)
[2014-02-04 11:08:46] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/cerulean-e95335988bef420c8d08256a4348651d.css" for 127.0.0.1 at 2014-02-04 11:08:46 -0200
Served asset /cerulean-e95335988bef420c8d08256a4348651d.css - 304 Not Modified (0ms)
[2014-02-04 11:08:46] WARN Could not determine content-length of response body. Set content- length of the response or set Response#chunked = true
Started GET "/assets/application-112486149e37a46f8edf68319a3cc0da.js" for 127.0.0.1 at 2014-02-04 11:08:46 -0200
Served asset /application-112486149e37a46f8edf68319a3cc0da.js - 304 Not Modified (107ms)
Started GET "/assets/logo-scaled-3757028be58a8cc4ac22912194a7f4e3.png" for 127.0.0.1 at 2014-02-04 11:08:46 -0200
Served asset /logo-scaled-3757028be58a8cc4ac22912194a7f4e3.png - 304 Not Modified (0ms)
[2014-02-04 11:08:46] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2014-02-04 11:08:46] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true