diff options
29 files changed, 212 insertions, 53 deletions
@@ -67,7 +67,7 @@ end platforms :jruby do gem 'json' - gem 'activerecord-jdbcsqlite3-adapter', '>= 1.2.0' + gem 'activerecord-jdbcsqlite3-adapter', '>= 1.2.7' # This is needed by now to let tests work on JRuby # TODO: When the JRuby guys merge jruby-openssl in @@ -75,8 +75,8 @@ platforms :jruby do gem 'jruby-openssl' group :db do - gem 'activerecord-jdbcmysql-adapter', '>= 1.2.0' - gem 'activerecord-jdbcpostgresql-adapter', '>= 1.2.0' + gem 'activerecord-jdbcmysql-adapter', '>= 1.2.7' + gem 'activerecord-jdbcpostgresql-adapter', '>= 1.2.7' end end diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 3bc15fd5a1..c952e2c9d1 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -3,7 +3,7 @@ * No changes. -## Rails 3.2.13 (Feb 17, 2013) ## +## Rails 3.2.13 ## * No changes. diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index f1eb9e84f6..79ee22921c 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,9 +1,13 @@ ## unreleased ## +* Include I18n locale fallbacks in view lookup. + Fixes GH#3512. + + *Juan Barreneche* * No changes. -## Rails 3.2.13 (Feb 17, 2013) ## +## Rails 3.2.13 ## * Fix incorrectly appended square brackets to a multiple select box if an explicit name has been given and it already ends with "[]". @@ -22,6 +26,16 @@ *Olek Janiszewski* +<<<<<<< HEAD +* Fix `ActionDispatch::Request#formats` when the Accept request-header is an + empty string. Fix #7774 [Backport #8977, #9541] + + *Soylent + Maxime Réty* + +## Rails 3.2.13.rc1 (Feb 17, 2013) ## + +======= +>>>>>>> 3-2-13 * Determine the controller#action from only the matched path when using the shorthand syntax. Previously the complete path was used, which led to problems with nesting (scopes and namespaces). @@ -43,7 +57,7 @@ *Sergey Nartimov* -* Eagerly populate the http method loookup cache so local project inflections do +* Eagerly populate the http method lookup cache so local project inflections do not interfere with use of underscore method ( and we don't need locks ) *Aditya Sanghi* diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb index 5c48a60469..42f14bc1e9 100644 --- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb +++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb @@ -98,8 +98,8 @@ module ActionDispatch BROWSER_LIKE_ACCEPTS = /,\s*\*\/\*|\*\/\*\s*,/ def valid_accept_header - (xhr? && (accept || content_mime_type)) || - (accept && accept !~ BROWSER_LIKE_ACCEPTS) + (xhr? && (accept.present? || content_mime_type)) || + (accept.present? && accept !~ BROWSER_LIKE_ACCEPTS) end def use_accept_header diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6b272704ea..d71b21efc3 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -67,8 +67,6 @@ module ActionDispatch private def normalize_options! - path_without_format = @path.sub(/\(\.:format\)$/, '') - @options.merge!(default_controller_and_action) requirements.each do |name, requirement| diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index b627c77dca..4519230fda 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -360,7 +360,7 @@ module ActionView end - STORAGE_UNITS = [:byte, :kb, :mb, :gb, :tb].freeze + STORAGE_UNITS = [:byte, :kb, :mb, :gb, :tb] # Formats the bytes in +number+ into a more understandable # representation (e.g., giving it 1500 yields 1.5 KB). This @@ -452,7 +452,7 @@ module ActionView end DECIMAL_UNITS = {0 => :unit, 1 => :ten, 2 => :hundred, 3 => :thousand, 6 => :million, 9 => :billion, 12 => :trillion, 15 => :quadrillion, - -1 => :deci, -2 => :centi, -3 => :mili, -6 => :micro, -9 => :nano, -12 => :pico, -15 => :femto}.freeze + -1 => :deci, -2 => :centi, -3 => :mili, -6 => :micro, -9 => :nano, -12 => :pico, -15 => :femto} # Pretty prints (formats and approximates) a number in a way it # is more readable by humans (eg.: 1200000000 becomes "1.2 diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 33b508e9b5..9f617a9a53 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -44,7 +44,13 @@ module ActionView module Accessors #:nodoc: end - register_detail(:locale) { [I18n.locale, I18n.default_locale].uniq } + register_detail(:locale) do + locales = [I18n.locale] + locales.concat(I18n.fallbacks[I18n.locale]) if I18n.respond_to? :fallbacks + locales << I18n.default_locale + locales.uniq! + locales + end register_detail(:formats) { Mime::SET.symbols } register_detail(:handlers){ Template::Handlers.extensions } diff --git a/actionpack/test/controller/localized_templates_test.rb b/actionpack/test/controller/localized_templates_test.rb index 41ff2f3809..a5fc3f614a 100644 --- a/actionpack/test/controller/localized_templates_test.rb +++ b/actionpack/test/controller/localized_templates_test.rb @@ -19,4 +19,13 @@ class LocalizedTemplatesTest < ActionController::TestCase get :hello_world assert_equal "Hello World", @response.body end + + def test_use_fallback_locales + I18n.locale = :"de-AT" + I18n.backend.class.send(:include, I18n::Backend::Fallbacks) + I18n.fallbacks[:"de-AT"] = [:de] + + get :hello_world + assert_equal "Gutten Tag", @response.body + end end
\ No newline at end of file diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index dfd3ddbfa6..222cdfde1f 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -481,6 +481,15 @@ class RequestTest < ActiveSupport::TestCase request.expects(:parameters).at_least_once.returns({}) assert_equal [ Mime::HTML ], request.formats + request = stub_request 'HTTP_ACCEPT' => '' + request.expects(:parameters).at_least_once.returns({}) + assert_equal [Mime::HTML], request.formats + + request = stub_request 'HTTP_ACCEPT' => '', + 'HTTP_X_REQUESTED_WITH' => "XMLHttpRequest" + request.expects(:parameters).at_least_once.returns({}) + assert_equal [Mime::JS], request.formats + request = stub_request 'CONTENT_TYPE' => 'application/xml; charset=UTF-8', 'HTTP_X_REQUESTED_WITH' => "XMLHttpRequest" request.expects(:parameters).at_least_once.returns({}) diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index 1464f52066..cfc766d2be 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -3,7 +3,7 @@ * No changes. -## Rails 3.2.13 (Feb 17, 2013) ## +## Rails 3.2.13 ## * Specify type of singular association during serialization *Steve Klabnik* diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index ec017f8623..43c1a4565f 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,11 +1,26 @@ ## Rails 3.2.13 (Feb 17, 2013) ## +* Reload the association target if it's stale. `@stale_state` should be nil + when a model isn't saved. + Fixes #7526. + + *Larry Lv* + +* Don't read CSV files during execution of `db:fixtures:load`. CSV support for + fixtures was removed some time ago but the task was still loading them, even + though later the code was looking for the related yaml file instead. + + *kennyj* + + +## Rails 3.2.13.rc1 (Feb 17, 2013) ## + * Reverted 921a296a3390192a71abeec6d9a035cc6d1865c8, 'Quote numeric values compared to string columns.' This caused several regressions. *Steve Klabnik* -* Fix overriding of attributes by default_scope on `ActiveRecord::Base#dup`. +* Fix overriding of attributes by `default_scope` on `ActiveRecord::Base#dup`. *Hiroshige UMINO* diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index ab0d888b16..99f307922e 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -46,6 +46,7 @@ module ActiveRecord @loaded = false IdentityMap.remove(target) if IdentityMap.enabled? && target @target = nil + @stale_state = nil end # Reloads the \target and returns +self+ on success. @@ -128,16 +129,21 @@ module ActiveRecord # This method is abstract in the sense that it relies on +find_target+, # which is expected to be provided by descendants. # - # If the \target is already \loaded it is just returned. Thus, you can call - # +load_target+ unconditionally to get the \target. + # If the \target is stale(the target no longer points to the record(s) that the + # relevant foreign_key(s) refers to.), force reload the \target. + # + # Otherwise if the \target is already \loaded it is just returned. Thus, you can + # call +load_target+ unconditionally to get the \target. # # ActiveRecord::RecordNotFound is rescued within the method, and it is # not reraised. The proxy is \reset and +nil+ is the return value. def load_target - if find_target? + if (@stale_state && stale_target?) || find_target? begin if IdentityMap.enabled? && association_class && association_class.respond_to?(:base_class) @target = IdentityMap.get(association_class, owner[reflection.foreign_key]) + elsif @stale_state && stale_target? + @target = find_target end rescue NameError nil diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 97f531d064..52c67df646 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -72,7 +72,7 @@ module ActiveRecord end def stale_state - owner[reflection.foreign_key].to_s + owner[reflection.foreign_key] && owner[reflection.foreign_key].to_s end end end diff --git a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb index 2ee5dbbd70..88ce03a3cd 100644 --- a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb @@ -27,7 +27,8 @@ module ActiveRecord end def stale_state - [super, owner[reflection.foreign_type].to_s] + foreign_key = super + foreign_key && [foreign_key.to_s, owner[reflection.foreign_type].to_s] end end end diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index fd0e90aaf0..be890e5767 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -62,7 +62,7 @@ module ActiveRecord # properly support stale-checking for nested associations. def stale_state if through_reflection.macro == :belongs_to - owner[through_reflection.foreign_key].to_s + owner[through_reflection.foreign_key] && owner[through_reflection.foreign_key].to_s end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index ddb6896257..6a5cff6acd 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -42,8 +42,8 @@ module ActiveRecord # Represents the schema of an SQL table in an abstract way. This class # provides methods for manipulating the schema representation. # - # Inside migration files, the +t+ object in +create_table+ and - # +change_table+ is actually of this type: + # Inside migration files, the +t+ object in +create_table+ + # is actually of this type: # # class SomeMigration < ActiveRecord::Migration # def up diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 8f7c7f6b00..7f1b84b848 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -355,7 +355,7 @@ db_namespace = namespace :db do base_dir = File.join [Rails.root, ENV['FIXTURES_PATH'] || %w{test fixtures}].flatten fixtures_dir = File.join [base_dir, ENV['FIXTURES_DIR']].compact - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.{yml,csv}"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file| + (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.yml"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file| ActiveRecord::Fixtures.create_fixtures(fixtures_dir, fixture_file) end end diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb index ee338a3b99..6556219205 100644 --- a/activerecord/test/cases/ar_schema_test.rb +++ b/activerecord/test/cases/ar_schema_test.rb @@ -11,8 +11,8 @@ if ActiveRecord::Base.connection.supports_migrations? def teardown @connection.drop_table :fruits rescue nil - @connection.drop_table :"_pre_fruits_suf_" rescue nil - @connection.drop_table :"_pre_schema_migrations_suf_" rescue nil + @connection.drop_table :"_p_fruits_s_" rescue nil + @connection.drop_table :"_p_schema_migrations_s_" rescue nil end def test_schema_define @@ -24,8 +24,9 @@ if ActiveRecord::Base.connection.supports_migrations? end def test_schema_define_with_table_prefix_and_suffix - ActiveRecord::Base.table_name_prefix = '_pre_' - ActiveRecord::Base.table_name_suffix = '_suf_' + # Use shorter prefix and suffix as in Oracle database identifier cannot be larger than 30 characters + ActiveRecord::Base.table_name_prefix = '_p_' + ActiveRecord::Base.table_name_suffix = '_s_' perform_schema_define! diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index f392366c19..c9b26895ae 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -14,6 +14,8 @@ require 'models/sponsor' require 'models/member' require 'models/essay' require 'models/toy' +require 'models/person' +require 'models/reader' class BelongsToAssociationsTest < ActiveRecord::TestCase fixtures :accounts, :companies, :developers, :projects, :topics, @@ -716,4 +718,16 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_equal toy, sponsor.reload.sponsorable end + + def test_saving_nested_association + post1, post2 = Post.limit(2) + person = Person.new(:first_name => 'foo') + reader = Reader.new(:post => post1) + + reader.post_id = post2.id + person.readers = [reader] + + assert person.save + assert_equal reader.post_id, post2.id + end end diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index 3652255c38..32726e8d8b 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -30,8 +30,7 @@ module ActiveRecord end def test_binds_are_logged - # FIXME: use skip with minitest - return unless @connection.supports_statement_cache? + return skip_bind_parameter_test unless supports_statement_cache? sub = @connection.substitute_at(@pk, 0) binds = [[@pk, 1]] @@ -44,8 +43,7 @@ module ActiveRecord end def test_find_one_uses_binds - # FIXME: use skip with minitest - return unless @connection.supports_statement_cache? + return skip_bind_parameter_test unless supports_statement_cache? Topic.find(1) binds = [[@pk, 1]] @@ -54,8 +52,7 @@ module ActiveRecord end def test_logs_bind_vars - # FIXME: use skip with minitest - return unless @connection.supports_statement_cache? + return skip_bind_parameter_test unless supports_statement_cache? pk = Topic.columns.find { |x| x.primary } @@ -86,5 +83,15 @@ module ActiveRecord logger.sql event assert_match([[pk.name, 10]].inspect, logger.debugs.first) end + + private + + def skip_bind_parameter_test + skip('prepared statement caching is not supported') + end + + def supports_statement_cache? + @connection.supports_statement_cache? + end end end diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 5b67d22c31..7f0d921545 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -61,7 +61,7 @@ if ActiveRecord::Base.connection.supports_migrations? ActiveRecord::Base.connection.initialize_schema_migrations_table ActiveRecord::Base.connection.execute "DELETE FROM #{ActiveRecord::Migrator.schema_migrations_table_name}" - %w(things awesome_things prefix_things_suffix prefix_awesome_things_suffix).each do |table| + %w(things awesome_things prefix_things_suffix p_awesome_things_s).each do |table| Thing.connection.drop_table(table) rescue nil end Thing.reset_column_information @@ -874,8 +874,6 @@ if ActiveRecord::Base.connection.supports_migrations? end def test_remove_column_with_array_as_an_argument_is_deprecated - return skip "remove_column with array as argument is not supported with OracleAdapter" if current_adapter? :OracleAdapter - ActiveRecord::Base.connection.create_table(:hats) do |table| table.column :hat_name, :string, :limit => 100 table.column :hat_size, :integer @@ -886,7 +884,7 @@ if ActiveRecord::Base.connection.supports_migrations? Person.connection.remove_column("hats", ["hat_name", "hat_size"]) end ensure - ActiveRecord::Base.connection.drop_table(:hats) rescue nil + ActiveRecord::Base.connection.drop_table(:hats) end def test_removing_and_renaming_column_preserves_custom_primary_key @@ -1647,8 +1645,8 @@ if ActiveRecord::Base.connection.supports_migrations? def test_rename_table_with_prefix_and_suffix assert !Thing.table_exists? - ActiveRecord::Base.table_name_prefix = 'prefix_' - ActiveRecord::Base.table_name_suffix = '_suffix' + ActiveRecord::Base.table_name_prefix = 'p_' + ActiveRecord::Base.table_name_suffix = '_s' Thing.reset_table_name Thing.reset_sequence_name WeNeedThings.up @@ -1657,7 +1655,7 @@ if ActiveRecord::Base.connection.supports_migrations? assert_equal "hello world", Thing.find(:first).content RenameThings.up - Thing.table_name = "prefix_awesome_things_suffix" + Thing.table_name = "p_awesome_things_s" assert_equal "hello world", Thing.find(:first).content ensure diff --git a/activeresource/CHANGELOG.md b/activeresource/CHANGELOG.md index 245b000f53..b10b382f5f 100644 --- a/activeresource/CHANGELOG.md +++ b/activeresource/CHANGELOG.md @@ -3,7 +3,7 @@ * No changes. -## Rails 3.2.13 (Feb 17, 2013) ## +## Rails 3.2.13 ## * No changes. diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index ea72f692d3..f15d906f1f 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,6 +1,9 @@ ## unreleased ## -* No changes. +* Fix `ActiveSupport::TimeZone.parse` when time is at a local DST jump. + Fixes #9678. + + *Andrew White* ## Rails 3.2.13 (Feb 17, 2013) ## diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec index cbe0947a8a..fb3575b865 100644 --- a/activesupport/activesupport.gemspec +++ b/activesupport/activesupport.gemspec @@ -18,6 +18,6 @@ Gem::Specification.new do |s| s.rdoc_options.concat ['--encoding', 'UTF-8'] - s.add_dependency('i18n', '= 0.6.1') + s.add_dependency('i18n', '~> 0.6', '>= 0.6.4') s.add_dependency('multi_json', '~> 1.0') end diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index c7d8fc2e17..f935180036 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -268,13 +268,23 @@ module ActiveSupport # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00 # Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 def parse(str, now=now) - date_parts = Date._parse(str) - return if date_parts.blank? - time = Time.parse(str, now) rescue DateTime.parse(str) - if date_parts[:offset].nil? - ActiveSupport::TimeWithZone.new(nil, self, time) + parts = Date._parse(str, false) + return if parts.empty? + + time = Time.utc( + parts.fetch(:year, now.year), + parts.fetch(:mon, now.month), + parts.fetch(:mday, now.day), + parts.fetch(:hour, 0), + parts.fetch(:min, 0), + parts.fetch(:sec, 0), + parts.fetch(:sec_fraction, 0) * 1000000 + ) + + if parts[:offset] + TimeWithZone.new(time - parts[:offset], self) else - time.in_time_zone(self) + TimeWithZone.new(nil, self, time) end end diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index 8ecfc1e47e..bd4bfca82c 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -198,6 +198,62 @@ class TimeZoneTest < Test::Unit::TestCase assert_equal Time.utc(1999,12,31,19), twz.time end + def test_parse_should_not_black_out_system_timezone_dst_jump + with_env_tz('EET') do + zone = ActiveSupport::TimeZone['Pacific Time (US & Canada)'] + twz = zone.parse('2012-03-25 03:29:00') + assert_equal [0, 29, 3, 25, 3, 2012], twz.to_a[0,6] + end + end + + def test_parse_should_black_out_app_timezone_dst_jump + with_env_tz('EET') do + zone = ActiveSupport::TimeZone['Pacific Time (US & Canada)'] + twz = zone.parse('2012-03-11 02:29:00') + assert_equal [0, 29, 3, 11, 3, 2012], twz.to_a[0,6] + end + end + + def test_parse_with_javascript_date + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + twz = zone.parse("Mon May 28 2012 00:00:00 GMT-0700 (PDT)") + assert_equal Time.utc(2012, 5, 28, 7, 0, 0), twz.utc + end + + def test_parse_with_missing_time_components + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + zone.stubs(:now).returns zone.local(1999, 12, 31, 12, 59, 59) + twz = zone.parse('2012-12-01') + assert_equal Time.utc(2012, 12, 1), twz.time + end + + def test_parse_doesnt_use_local_dst + with_env_tz 'US/Eastern' do + zone = ActiveSupport::TimeZone['UTC'] + twz = zone.parse('2013-03-10 02:00:00') + assert_equal Time.utc(2013, 3, 10, 2, 0, 0), twz.time + end + end + + def test_parse_handles_dst_jump + with_env_tz 'US/Eastern' do + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + twz = zone.parse('2013-03-10 02:00:00') + assert_equal Time.utc(2013, 3, 10, 3, 0, 0), twz.time + end + end + + def test_parse_with_fractional_seconds + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + twz = zone.parse('2013-03-13 00:00:00.000001') + assert_equal 1, twz.usec + + if twz.respond_to?(:nsec) + twz = zone.parse('2013-03-13 00:00:00.000000001') + assert_equal 1, twz.nsec + end + end + def test_utc_offset_lazy_loaded_from_tzinfo_when_not_passed_in_to_initialize tzinfo = TZInfo::Timezone.get('America/New_York') zone = ActiveSupport::TimeZone.create(tzinfo.name, nil, tzinfo) diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 8064b0b5cc..2b5af96fe3 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -3,7 +3,7 @@ * No changes. -## Rails 3.2.13 (Feb 17, 2013) ## +## Rails 3.2.13 ## * No changes. diff --git a/railties/guides/source/caching_with_rails.textile b/railties/guides/source/caching_with_rails.textile index 0e811a2527..c2ca5a335d 100644 --- a/railties/guides/source/caching_with_rails.textile +++ b/railties/guides/source/caching_with_rails.textile @@ -86,9 +86,9 @@ Or, you can set custom gzip compression level (level names are taken from +Zlib+ caches_page :image, :gzip => :best_speed </ruby> -NOTE: Page caching ignores all parameters. For example +/products?page=1+ will be written out to the filesystem as +products.html+ with no reference to the +page+ parameter. Thus, if someone requests +/products?page=2+ later, they will get the cached first page. A workaround for this limitation is to include the parameters in the page's path, e.g. +/productions/page/1+. +NOTE: Page caching ignores all parameters. For example +/products?page=1+ will be written out to the filesystem as +products.html+ with no reference to the +page+ parameter. Thus, if someone requests +/products?page=2+ later, they will get the cached first page. A workaround for this limitation is to include the parameters in the products's path, e.g. +/products/page/1+. -INFO: Page caching runs in an after filter. Thus, invalid requests won't generate spurious cache entries as long as you halt them. Typically, a redirection in some before filter that checks request preconditions does the job. +INFO: Page caching runs as an after filter. Thus, invalid requests won't generate spurious cache entries as long as you halt them. Typically, a redirection in some before filter that checks request preconditions does the job. h4. Action Caching diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index ab9084df55..107b54c0be 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -122,6 +122,18 @@ module ApplicationTests assert_equal 0, ::AppTemplate::Application::User.count end + def test_loading_only_yml_fixtures + Dir.chdir(app_path) do + `rake db:migrate` + end + + app_file "test/fixtures/products.csv", "" + + require "#{rails_root}/config/environment" + errormsg = Dir.chdir(app_path) { `rake db:fixtures:load` } + assert $?.success?, errormsg + end + def test_scaffold_tests_pass_by_default content = Dir.chdir(app_path) do `rails generate scaffold user username:string password:string` |