diff options
Diffstat (limited to 'railties/lib/rails')
8 files changed, 29 insertions, 38 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index c163081bfc..10fa63c303 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -229,32 +229,32 @@ module Rails middleware.use ::Rack::SSL, config.ssl_options end + if config.action_dispatch.x_sendfile_header.present? + middleware.use ::Rack::Sendfile, config.action_dispatch.x_sendfile_header + end + if config.serve_static_assets middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control end middleware.use ::Rack::Lock unless config.allow_concurrency middleware.use ::Rack::Runtime - middleware.use ::Rack::MethodOverride + middleware.use ::Rack::MethodOverride unless config.middleware.api_only? middleware.use ::ActionDispatch::RequestId middleware.use ::Rails::Rack::Logger, config.log_tags # must come after Rack::MethodOverride to properly log overridden methods middleware.use ::ActionDispatch::ShowExceptions, config.exceptions_app || ActionDispatch::PublicExceptions.new(Rails.public_path) middleware.use ::ActionDispatch::DebugExceptions middleware.use ::ActionDispatch::RemoteIp, config.action_dispatch.ip_spoofing_check, config.action_dispatch.trusted_proxies - if config.action_dispatch.x_sendfile_header.present? - middleware.use ::Rack::Sendfile, config.action_dispatch.x_sendfile_header - end - unless config.cache_classes app = self middleware.use ::ActionDispatch::Reloader, lambda { app.reload_dependencies? } end middleware.use ::ActionDispatch::Callbacks - middleware.use ::ActionDispatch::Cookies + middleware.use ::ActionDispatch::Cookies unless config.middleware.api_only? - if config.session_store + if !config.middleware.api_only? && config.session_store if config.force_ssl && !config.session_options.key?(:secure) config.session_options[:secure] = true end @@ -267,7 +267,7 @@ module Rails middleware.use ::Rack::ConditionalGet middleware.use ::Rack::ETag, "no-cache" - if config.action_dispatch.best_standards_support + if !config.middleware.api_only? && config.action_dispatch.best_standards_support middleware.use ::ActionDispatch::BestStandardsSupport, config.action_dispatch.best_standards_support end end diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 1e424d9b4a..0f5fc2b7bc 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -11,7 +11,7 @@ module Rails :force_ssl, :helpers_paths, :logger, :log_tags, :preload_frameworks, :railties_order, :relative_url_root, :secret_token, :serve_static_assets, :ssl_options, :static_cache_control, :session_options, - :time_zone, :reload_classes_only_on_change + :time_zone, :reload_classes_only_on_change, :use_schema_cache_dump attr_writer :log_level attr_reader :encoding @@ -41,6 +41,7 @@ module Rails @file_watcher = ActiveSupport::FileUpdateChecker @exceptions_app = nil @autoflush_log = true + @use_schema_cache_dump = true @assets = ActiveSupport::OrderedOptions.new @assets.enabled = false diff --git a/railties/lib/rails/application/route_inspector.rb b/railties/lib/rails/application/route_inspector.rb index 2ca0c68243..1e5ce67a58 100644 --- a/railties/lib/rails/application/route_inspector.rb +++ b/railties/lib/rails/application/route_inspector.rb @@ -64,7 +64,7 @@ module Rails # executes `rake routes`. People should not use this class. class RouteInspector # :nodoc: def initialize - @engines = ActiveSupport::OrderedHash.new + @engines = Hash.new end def format all_routes, filter = nil diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index f8ad17773a..0efa21d82c 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -9,6 +9,14 @@ module Rails class MiddlewareStackProxy #:nodoc: def initialize @operations = [] + @api_only = false + end + + attr_reader :api_only + alias :api_only? :api_only + + def api_only! + @api_only = true end def insert_before(*args, &block) diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index acf47a03e5..e47784994a 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -54,7 +54,7 @@ module <%= app_const_base %> # This will create an empty whitelist of attributes available for mass-assignment for all models # in your app. As such, your models will need to explicitly whitelist or blacklist accessible # parameters by using an attr_accessible or attr_protected declaration. - # config.active_record.whitelist_attributes = true + <%= comment_if :skip_active_record %>config.active_record.whitelist_attributes = true # Specifies wether or not has_many or has_one association option :dependent => :restrict raises # an exception. If set to true, then an ActiveRecord::DeleteRestrictionError exception would be diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml index 950016ad92..c3349912aa 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml @@ -12,9 +12,7 @@ development: adapter: mysql2 encoding: utf8 database: <%= app_name %>_development - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 username: root password: <% if mysql_socket -%> @@ -30,9 +28,7 @@ test: adapter: mysql2 encoding: utf8 database: <%= app_name %>_test - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 username: root password: <% if mysql_socket -%> @@ -45,9 +41,7 @@ production: adapter: mysql2 encoding: utf8 database: <%= app_name %>_production - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 username: root password: <% if mysql_socket -%> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml index a8ed15c2dc..f08f86aac3 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml @@ -16,9 +16,7 @@ development: adapter: postgresql encoding: unicode database: <%= app_name %>_development - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 username: <%= app_name %> password: @@ -44,9 +42,7 @@ test: adapter: postgresql encoding: unicode database: <%= app_name %>_test - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 username: <%= app_name %> password: @@ -54,8 +50,6 @@ production: adapter: postgresql encoding: unicode database: <%= app_name %>_production - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 username: <%= app_name %> password: diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml index 32a998ad72..51a4dd459d 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml @@ -6,9 +6,7 @@ development: adapter: sqlite3 database: db/development.sqlite3 - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and @@ -17,15 +15,11 @@ development: test: adapter: sqlite3 database: db/test.sqlite3 - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 - # Maximum number of database connections available per process. Please - # increase this number in multithreaded applications. - pool: 1 + pool: 5 timeout: 5000 |