aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/base.rb2
-rw-r--r--activemodel/CHANGELOG2
-rw-r--r--activemodel/lib/active_model/serializers/json.rb8
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
-rwxr-xr-xactiverecord/test/cases/base_test.rb3
-rw-r--r--activerecord/test/cases/inheritance_test.rb3
-rw-r--r--activerecord/test/cases/modules_test.rb4
-rw-r--r--activerecord/test/cases/reflection_test.rb4
-rw-r--r--activesupport/CHANGELOG3
-rw-r--r--activesupport/lib/active_support/json/encoding.rb3
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb7
m---------rack0
-rw-r--r--railties/CHANGELOG4
-rw-r--r--railties/lib/rails/application.rb18
-rw-r--r--railties/lib/rails/configuration.rb4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb1
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config.ru5
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb7
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb19
-rw-r--r--railties/lib/rails/generators/rails/app/templates/test/test_helper.rb25
-rw-r--r--railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb4
24 files changed, 57 insertions, 79 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 782b4229fb..7673b9fe56 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Added that ActionController::Base now does helper :all instead of relying on the default ApplicationController in Rails to do it [DHH]
+
* Added ActionDispatch::Request#authorization to access the http authentication header regardless of its proxy hiding [DHH]
* Added :alert, :notice, and :flash as options to ActionController::Base#redirect_to that'll automatically set the proper flash before the redirection [DHH]. Examples:
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index b23be66910..746ab3e6db 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -6,6 +6,8 @@ module ActionController
include AbstractController::Layouts
include ActionController::Helpers
+ helper :all # By default, all helpers should be included
+
include ActionController::HideActions
include ActionController::UrlFor
include ActionController::Redirecting
diff --git a/activemodel/CHANGELOG b/activemodel/CHANGELOG
index 26500568ee..7489c0daa5 100644
--- a/activemodel/CHANGELOG
+++ b/activemodel/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Change the ActiveModel::Base.include_root_in_json default to true for Rails 3 [DHH]
+
* Add validates_format_of :without => /regexp/ option. #430 [Elliot Winkler, Peer Allan]
Example :
diff --git a/activemodel/lib/active_model/serializers/json.rb b/activemodel/lib/active_model/serializers/json.rb
index ee6d48bfc6..794de7dc55 100644
--- a/activemodel/lib/active_model/serializers/json.rb
+++ b/activemodel/lib/active_model/serializers/json.rb
@@ -10,19 +10,17 @@ module ActiveModel
included do
extend ActiveModel::Naming
- cattr_accessor :include_root_in_json, :instance_writer => false
+ cattr_accessor :include_root_in_json, :instance_writer => true
end
# Returns a JSON string representing the model. Some configuration is
# available through +options+.
#
- # The option <tt>ActiveRecord::Base.include_root_in_json</tt> controls the
- # top-level behavior of to_json. In a new Rails application, it is set to
- # <tt>true</tt> in initializers/new_rails_defaults.rb. When it is <tt>true</tt>,
+ # The option <tt>ActiveModel::Base.include_root_in_json</tt> controls the
+ # top-level behavior of to_json. It is true by default. When it is <tt>true</tt>,
# to_json will emit a single root node named after the object's type. For example:
#
# konata = User.find(1)
- # ActiveRecord::Base.include_root_in_json = true
# konata.to_json
# # => { "user": {"id": 1, "name": "Konata Izumi", "age": 16,
# "created_at": "2006/08/01", "awesome": true} }
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 0cfd8cdc87..38bcf0c787 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH]
+
* Add Relation#except. [Pratik Naik]
one_red_item = Item.where(:colour => 'red').limit(1)
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index ec7725d256..026bf55aaa 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -550,7 +550,7 @@ module ActiveRecord #:nodoc:
# Determine whether to store the full constant name including namespace when using STI
superclass_delegating_accessor :store_full_sti_class
- self.store_full_sti_class = false
+ self.store_full_sti_class = true
# Stores the default scope for the class
class_inheritable_accessor :default_scoping, :instance_writer => false
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 730d9d8df7..47e7a4bb79 100755
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -2138,8 +2138,11 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_type_name_with_module_should_handle_beginning
+ ActiveRecord::Base.store_full_sti_class = false
assert_equal 'ActiveRecord::Person', ActiveRecord::Base.send(:type_name_with_module, 'Person')
assert_equal '::Person', ActiveRecord::Base.send(:type_name_with_module, '::Person')
+ ensure
+ ActiveRecord::Base.store_full_sti_class = true
end
def test_to_param_should_return_string
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb
index 73e51fbd91..0672fb938b 100644
--- a/activerecord/test/cases/inheritance_test.rb
+++ b/activerecord/test/cases/inheritance_test.rb
@@ -241,6 +241,7 @@ class InheritanceComputeTypeTest < ActiveRecord::TestCase
end
def test_instantiation_doesnt_try_to_require_corresponding_file
+ ActiveRecord::Base.store_full_sti_class = false
foo = Firm.find(:first).clone
foo.ruby_type = foo.type = 'FirmOnTheFly'
foo.save!
@@ -259,5 +260,7 @@ class InheritanceComputeTypeTest < ActiveRecord::TestCase
# And instantiate will find the existing constant rather than trying
# to require firm_on_the_fly.
assert_nothing_raised { assert_kind_of Firm::FirmOnTheFly, Firm.find(foo.id) }
+ ensure
+ ActiveRecord::Base.store_full_sti_class = true
end
end
diff --git a/activerecord/test/cases/modules_test.rb b/activerecord/test/cases/modules_test.rb
index 4f559bcaa5..d781a229f4 100644
--- a/activerecord/test/cases/modules_test.rb
+++ b/activerecord/test/cases/modules_test.rb
@@ -12,6 +12,8 @@ class ModulesTest < ActiveRecord::TestCase
[:Firm, :Client].each do |const|
@undefined_consts.merge! const => Object.send(:remove_const, const) if Object.const_defined?(const)
end
+
+ ActiveRecord::Base.store_full_sti_class = false
end
def teardown
@@ -19,6 +21,8 @@ class ModulesTest < ActiveRecord::TestCase
@undefined_consts.each do |constant, value|
Object.send :const_set, constant, value unless value.nil?
end
+
+ ActiveRecord::Base.store_full_sti_class = true
end
def test_module_spanning_associations
diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb
index acd214eb5a..211cf1d449 100644
--- a/activerecord/test/cases/reflection_test.rb
+++ b/activerecord/test/cases/reflection_test.rb
@@ -137,6 +137,8 @@ class ReflectionTest < ActiveRecord::TestCase
end
def test_association_reflection_in_modules
+ ActiveRecord::Base.store_full_sti_class = false
+
assert_reflection MyApplication::Business::Firm,
:clients_of_firm,
:klass => MyApplication::Business::Client,
@@ -172,6 +174,8 @@ class ReflectionTest < ActiveRecord::TestCase
:klass => MyApplication::Billing::Nested::Firm,
:class_name => 'Nested::Firm',
:table_name => 'companies'
+ ensure
+ ActiveRecord::Base.store_full_sti_class = true
end
def test_reflection_of_all_associations
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 9b0a84678a..87ec6f2a2c 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,8 @@
*Edge*
+* Changed the default ActiveSupport.use_standard_json_time_format from false to true and
+ActiveSupport.escape_html_entities_in_json from true to false to match previously announced Rails 3 defaults [DHH]
+
* Added Object#presence that returns the object if it's #present? otherwise returns nil [DHH/Colin Kelley]
* Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if !x.include?/else calls [DHH]
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index c8415d5449..8ba45f7ea2 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -114,7 +114,8 @@ module ActiveSupport
end
end
- self.escape_html_entities_in_json = true
+ self.use_standard_json_time_format = true
+ self.escape_html_entities_in_json = false
end
CircularReferenceError = Deprecation::DeprecatedConstantProxy.new('ActiveSupport::JSON::CircularReferenceError', Encoding::CircularReferenceError)
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 6b554e7158..710dce78de 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -32,7 +32,6 @@ module ActiveSupport
# t.is_a?(Time) # => true
# t.is_a?(ActiveSupport::TimeWithZone) # => true
class TimeWithZone
-
def self.name
'Time' # Report class name as 'Time' to thwart type checking
end
@@ -114,9 +113,9 @@ module ActiveSupport
end
alias_method :iso8601, :xmlschema
- # Coerces the date to a string for JSON encoding.
- #
- # ISO 8601 format is used if ActiveSupport::JSON::Encoding.use_standard_json_time_format is set.
+ # Coerces the date to a string for JSON encoding. The default format is ISO 8601. You can get
+ # %Y/%m/%d %H:%M:%S +offset style by setting ActiveSupport::JSON::Encoding.use_standard_json_time_format
+ # to false.
#
# ==== Examples
#
diff --git a/rack b/rack
-Subproject c6805fb93da30e0056b38e0fa6015c3d1bca587
+Subproject 1ffa95c55394c862798727ac8b203ecedda8842
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 0bc1ea32bc..fc9277bd28 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,9 @@
*Edge*
+* Removed config/initializers/new_rails_defaults.rb as all frameworks now follow the settings from it [DHH]
+
+* Set config.time_zone to UTC by default [DHH]
+
* Added default .gitignore (this is just recognizing Git market share, don't throw a hissy if you use another SCM) [DHH]
* Added cookies.permanent, cookies.signed, and cookies.permanent.signed accessor for common cookie actions [DHH]. Examples:
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 5401251397..3fb4b723ab 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -207,18 +207,16 @@ module Rails
# Sets the default value for Time.zone
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
initializer :initialize_time_zone do
- if config.time_zone
- require 'active_support/core_ext/time/zones'
- zone_default = Time.__send__(:get_zone, config.time_zone)
-
- unless zone_default
- raise \
- 'Value assigned to config.time_zone not recognized.' +
- 'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
- end
+ require 'active_support/core_ext/time/zones'
+ zone_default = Time.__send__(:get_zone, config.time_zone)
- Time.zone_default = zone_default
+ unless zone_default
+ raise \
+ 'Value assigned to config.time_zone not recognized.' +
+ 'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
end
+
+ Time.zone_default = zone_default
end
# Set the i18n configuration from config.i18n but special-case for the load_path which should be
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index f0a0d5e55e..7c1d549c9a 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -230,6 +230,10 @@ module Rails
def log_level
@log_level ||= RAILS_ENV == 'production' ? :info : :debug
end
+
+ def time_zone
+ @time_zone ||= "UTC"
+ end
def i18n
@i18n ||= begin
diff --git a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
index 9889b52893..2cdf4eae54 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
+++ b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
@@ -1,8 +1,4 @@
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
class ApplicationController < ActionController::Base
- helper :all
protect_from_forgery
filter_parameter_logging :password
end
diff --git a/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb b/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb
index 22a7940eb2..de6be7945c 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb
+++ b/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb
@@ -1,3 +1,2 @@
-# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
diff --git a/railties/lib/rails/generators/rails/app/templates/config.ru b/railties/lib/rails/generators/rails/app/templates/config.ru
index acb8435446..2ab821e38d 100644
--- a/railties/lib/rails/generators/rails/app/templates/config.ru
+++ b/railties/lib/rails/generators/rails/app/templates/config.ru
@@ -1,5 +1,4 @@
-# Require your environment file to bootstrap Rails
-require ::File.expand_path('../config/environment', __FILE__)
+# This file is used by Rack-based servers to start the application.
-# Dispatch the request
+require ::File.expand_path('../config/environment', __FILE__)
run <%= app_const %>.instance
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 4097f766a6..dce5b55d86 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -17,15 +17,14 @@ module <%= app_name.classify %>
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- # Run "rake -D time" for a list of tasks for finding time zone names.
- config.time_zone = 'UTC'
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
- # Configure generators values. Many other options are available, be sure to
- # check the documentation.
+ # Configure generators values. Many other options are available, be sure to check the documentation.
# config.generators do |g|
# g.orm :active_record
# g.template_engine :erb
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb
deleted file mode 100644
index 8ec3186c84..0000000000
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# These settings change the behavior of Rails 2 apps and will be defaults
-# for Rails 3. You can remove this initializer when Rails 3 is released.
-
-if defined?(ActiveRecord)
- # Include Active Record class name as root for JSON serialized output.
- ActiveRecord::Base.include_root_in_json = true
-
- # Store the full class name (including module namespace) in STI type column.
- ActiveRecord::Base.store_full_sti_class = true
-end
-
-# Use ISO 8601 format for JSON serialized times and dates.
-ActiveSupport.use_standard_json_time_format = true
-
-# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
-# if you're including raw json in an HTML page.
-ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file
diff --git a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb
index a16f587d8b..45b551fc7d 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb
+++ b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb
@@ -3,31 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rails/test_help'
class ActiveSupport::TestCase
- # Transactional fixtures accelerate your tests by wrapping each test method
- # in a transaction that's rolled back on completion. This ensures that the
- # test database remains unchanged so your fixtures don't have to be reloaded
- # between every test method. Fewer database queries means faster tests.
- #
- # Read Mike Clark's excellent walkthrough at
- # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
- #
- # Every Active Record database supports transactions except MyISAM tables
- # in MySQL. Turn off transactional fixtures in this case; however, if you
- # don't care one way or the other, switching from MyISAM to InnoDB tables
- # is recommended.
- #
- # The only drawback to using transactional fixtures is when you actually
- # need to test transactions. Since your test is bracketed by a transaction,
- # any transactions started in your code will be automatically rolled back.
- self.use_transactional_fixtures = true
-
- # Instantiated fixtures are slow, but give you @david where otherwise you
- # would need people(:david). If you don't want to migrate your existing
- # test cases which use the @david style and don't mind the speed hit (each
- # instantiated fixtures translates to a database query per test method),
- # then set this back to true.
- self.use_instantiated_fixtures = false
-
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
index e4bf4035da..9380aa49b6 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
+++ b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
@@ -16,7 +16,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
test "should create <%= file_name %>" do
assert_difference('<%= class_name %>.count') do
- post :create, :<%= file_name %> => { }
+ post :create, :<%= file_name %> => <%= table_name %>(:one).attributes
end
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
@@ -33,7 +33,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
end
test "should update <%= file_name %>" do
- put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => { }
+ put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => <%= table_name %>(:one).attributes
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
end