実稼働環境でアプリを起動すると、すべてのフォームがサーバーに対して:remote => true
. この問題について私が見つけたすべてがRails 3.1以降に含まれているアセットパイプラインに関連していることを知るまで、問題はアセット内の一部のファイルが何かを複製していることですが、通常の形式でも発生するため(ajaxなし)、私の場合ではないと思います)。
アプリケーションが使用する Web サーバーの場合、デフォルト設定ではシンです。
application.js のマニフェストに対する私の要件は次のとおりです。
//= require jquery
//= require jquery_ujs
//= require jquery.cycle.all
//= require jquery.alphanumeric
//= require jquery.pageless
//= require jquery.ui.min.js
//= require jquery.fastLiveFilter.js
//= require_tree .
このファイルは、require_tree が検索する別のパスで複製されません。
これは私の production.rb です
Web::Application.configure do
# Settings specified here will take precedence over those in 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 = true
# 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
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Amazon SES
config.action_mailer.delivery_method = :ses
end
これが私のapplication.rbです
require File.expand_path('../boot', __FILE__)
#require 'rails/all'
#require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie"
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Web
class Application < Rails::Application
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
#config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib", "#{config.root}/lib/**/"]
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
# Commented because we don't use AR nor DB
#config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end