aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-06-09 10:29:55 -0300
committerEmilio Tagua <miloops@gmail.com>2009-06-09 10:29:55 -0300
commit103b282130dd340143654801430aed787da4c9c6 (patch)
treeeddbe800d02f1a3c23f6266b808e74656af31f82
parentfd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90 (diff)
parenta94e7d7897a300a95d5d5a00c5efc573b42bcb58 (diff)
downloadrails-103b282130dd340143654801430aed787da4c9c6.tar.gz
rails-103b282130dd340143654801430aed787da4c9c6.tar.bz2
rails-103b282130dd340143654801430aed787da4c9c6.zip
Merge commit 'rails/master'
-rw-r--r--actionmailer/Rakefile3
-rw-r--r--actionmailer/lib/action_mailer.rb13
-rw-r--r--actionmailer/lib/action_mailer/base.rb2
-rw-r--r--actionpack/Rakefile1
-rw-r--r--actionpack/lib/action_controller/abstract.rb18
-rw-r--r--actionpack/lib/action_controller/abstract/base.rb119
-rw-r--r--actionpack/lib/action_controller/abstract/benchmarker.rb10
-rw-r--r--actionpack/lib/action_controller/abstract/callbacks.rb80
-rw-r--r--actionpack/lib/action_controller/abstract/exceptions.rb9
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb69
-rw-r--r--actionpack/lib/action_controller/base/http_authentication.rb4
-rw-r--r--actionpack/lib/action_controller/new_base/base.rb2
-rw-r--r--actionpack/lib/action_controller/routing/resources.rb4
-rw-r--r--actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb1
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb2
-rw-r--r--actionpack/lib/action_view/helpers.rb2
-rw-r--r--actionpack/lib/action_view/helpers/active_record_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/benchmark_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb27
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb3
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb5
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb7
-rw-r--r--actionpack/lib/action_view/template/error.rb2
-rw-r--r--actionpack/test/abstract_controller/abstract_controller_test.rb24
-rw-r--r--actionpack/test/abstract_controller/callbacks_test.rb32
-rw-r--r--actionpack/test/abstract_controller/helper_test.rb2
-rw-r--r--actionpack/test/abstract_controller/layouts_test.rb30
-rw-r--r--actionpack/test/controller/filters_test.rb10
-rw-r--r--actionpack/test/controller/helper_test.rb6
-rw-r--r--actionpack/test/controller/http_digest_authentication_test.rb14
-rw-r--r--actionpack/test/controller/routing_test.rb8
-rw-r--r--actionpack/test/dispatch/mime_type_test.rb4
-rw-r--r--actionpack/test/fixtures/test/_local_inspector.html.erb2
-rw-r--r--actionpack/test/new_base/abstract_unit.rb13
-rw-r--r--actionpack/test/template/erb_util_test.rb2
-rw-r--r--actionpack/test/template/form_helper_test.rb19
-rw-r--r--actionpack/test/template/form_tag_helper_test.rb5
-rw-r--r--actionpack/test/template/number_helper_test.rb42
-rw-r--r--actionpack/test/template/render_test.rb2
-rw-r--r--activemodel/lib/active_model.rb4
-rw-r--r--activemodel/lib/active_model/deprecated_error_methods.rb4
-rw-r--r--activemodel/lib/active_model/errors.rb17
-rw-r--r--activemodel/lib/active_model/validations.rb10
-rw-r--r--activemodel/lib/active_model/validations/acceptance.rb4
-rw-r--r--activemodel/lib/active_model/validations/confirmation.rb4
-rw-r--r--activemodel/lib/active_model/validations/exclusion.rb4
-rw-r--r--activemodel/lib/active_model/validations/format.rb4
-rw-r--r--activemodel/lib/active_model/validations/inclusion.rb4
-rw-r--r--activemodel/lib/active_model/validations/length.rb4
-rw-r--r--activemodel/lib/active_model/validations/numericality.rb4
-rw-r--r--activemodel/lib/active_model/validations/presence.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb16
-rw-r--r--activerecord/lib/active_record/serialization.rb5
-rw-r--r--activerecord/lib/active_record/serializers/json_serializer.rb32
-rw-r--r--activerecord/lib/active_record/validations.rb1
-rwxr-xr-xactiverecord/test/cases/base_test.rb71
-rw-r--r--activerecord/test/cases/json_serialization_test.rb8
-rw-r--r--activerecord/test/schema/oracle_specific_schema.rb19
-rw-r--r--activeresource/examples/simple.rb1
-rw-r--r--activeresource/lib/active_resource.rb19
-rw-r--r--activeresource/lib/active_resource/base.rb23
-rw-r--r--activeresource/lib/active_resource/connection.rb2
-rw-r--r--activeresource/lib/active_resource/custom_methods.rb73
-rw-r--r--activeresource/lib/active_resource/formats/json_format.rb4
-rw-r--r--activeresource/lib/active_resource/http_mock.rb1
-rw-r--r--activeresource/lib/active_resource/validations.rb13
-rw-r--r--activeresource/test/abstract_unit.rb1
-rw-r--r--activesupport/CHANGELOG6
-rw-r--r--activesupport/Rakefile10
-rw-r--r--activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/debugger.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/module/model_naming.rb8
-rw-r--r--activesupport/lib/active_support/core_ext/string/conversions.rb8
-rw-r--r--activesupport/lib/active_support/json.rb87
-rw-r--r--activesupport/lib/active_support/json/decoding.rb33
-rw-r--r--activesupport/lib/active_support/json/encoders/date.rb22
-rw-r--r--activesupport/lib/active_support/json/encoders/date_time.rb22
-rw-r--r--activesupport/lib/active_support/json/encoders/enumerable.rb13
-rw-r--r--activesupport/lib/active_support/json/encoders/false_class.rb6
-rw-r--r--activesupport/lib/active_support/json/encoders/hash.rb51
-rw-r--r--activesupport/lib/active_support/json/encoders/nil_class.rb6
-rw-r--r--activesupport/lib/active_support/json/encoders/numeric.rb6
-rw-r--r--activesupport/lib/active_support/json/encoders/object.rb13
-rw-r--r--activesupport/lib/active_support/json/encoders/regexp.rb6
-rw-r--r--activesupport/lib/active_support/json/encoders/string.rb6
-rw-r--r--activesupport/lib/active_support/json/encoders/symbol.rb6
-rw-r--r--activesupport/lib/active_support/json/encoders/time.rb24
-rw-r--r--activesupport/lib/active_support/json/encoders/true_class.rb6
-rw-r--r--activesupport/lib/active_support/json/encoding.rb230
-rw-r--r--activesupport/lib/active_support/new_callbacks.rb229
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb41
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb2
-rw-r--r--activesupport/lib/active_support/vendor.rb4
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Algiers.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Cairo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Casablanca.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb)2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Harare.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Johannesburg.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Monrovia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Nairobi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/Buenos_Aires.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/San_Juan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Bogota.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Caracas.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chicago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chihuahua.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Denver.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Godthab.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Guatemala.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Halifax.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Indiana/Indianapolis.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Juneau.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/La_Paz.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Lima.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Los_Angeles.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mazatlan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mexico_City.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Monterrey.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/New_York.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Phoenix.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Regina.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Santiago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Sao_Paulo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/St_Johns.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Tijuana.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Almaty.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baghdad.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baku.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Bangkok.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Chongqing.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Colombo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Dhaka.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Hong_Kong.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Irkutsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jakarta.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jerusalem.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kabul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kamchatka.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Karachi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb)2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kathmandu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb)4
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kolkata.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Krasnoyarsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuala_Lumpur.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuwait.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Magadan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Muscat.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Novosibirsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Rangoon.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Riyadh.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Seoul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Shanghai.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Singapore.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Taipei.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tashkent.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tbilisi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tehran.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tokyo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Ulaanbaatar.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Urumqi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Vladivostok.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yakutsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yekaterinburg.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yerevan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Azores.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Cape_Verde.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/South_Georgia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Adelaide.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Brisbane.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Darwin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Hobart.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Melbourne.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Perth.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Sydney.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Etc/UTC.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Amsterdam.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Athens.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Belgrade.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Berlin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bratislava.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Brussels.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bucharest.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Budapest.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Copenhagen.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Dublin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Helsinki.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Istanbul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Kiev.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Lisbon.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Ljubljana.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/London.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Madrid.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Minsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Moscow.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Paris.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Prague.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Riga.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Rome.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sarajevo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Skopje.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sofia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Stockholm.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Tallinn.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vienna.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vilnius.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Warsaw.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Zagreb.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Auckland.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Fiji.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Guam.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Honolulu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Majuro.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Midway.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Noumea.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Pago_Pago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Port_Moresby.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Tongatapu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/info_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/offset_rationals.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/ruby_core_support.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/time_or_datetime.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb)2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_definition.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_offset_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_period.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_transition_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb)0
-rw-r--r--activesupport/test/core_ext/module/model_naming_test.rb8
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb3
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb2
-rw-r--r--activesupport/test/json/encoding_test.rb19
-rw-r--r--activesupport/test/new_callback_inheritance_test.rb10
-rw-r--r--activesupport/test/new_callbacks_test.rb78
-rw-r--r--railties/lib/initializer.rb2
-rw-r--r--railties/lib/rails/gem_dependency.rb20
-rw-r--r--railties/lib/tasks/gems.rake14
-rw-r--r--railties/test/gem_dependency_test.rb16
241 files changed, 1118 insertions, 881 deletions
diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile
index 24c25abc8b..5475ffa493 100644
--- a/actionmailer/Rakefile
+++ b/actionmailer/Rakefile
@@ -4,7 +4,6 @@ require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
-require 'rake/contrib/sshpublisher'
require File.join(File.dirname(__FILE__), 'lib', 'action_mailer', 'version')
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
@@ -82,12 +81,14 @@ end
desc "Publish the API documentation"
task :pgem => [:package] do
+ require 'rake/contrib/sshpublisher'
Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
`ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
end
desc "Publish the API documentation"
task :pdoc => [:rdoc] do
+ require 'rake/contrib/sshpublisher'
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/am", "doc").upload
end
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index 02c536c8ad..a427376579 100644
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -21,16 +21,9 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-begin
- require 'action_controller'
-rescue LoadError
- actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib"
- if File.directory?(actionpack_path)
- $:.unshift actionpack_path
- require 'action_controller'
- end
-end
-
+actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib"
+$:.unshift(actionpack_path) if File.directory?(actionpack_path)
+require 'action_controller'
require 'action_view'
module ActionMailer
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index af2cc2ee24..0ddb3f0621 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -697,7 +697,7 @@ module ActionMailer #:nodoc:
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
- sender = (mail['return-path'] && mail['return-path'].spec) || mail.from
+ sender = (mail['return-path'] && mail['return-path'].spec) || mail['from']
smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index 5f5614e58f..074bc90ca9 100644
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -35,6 +35,7 @@ Rake::TestTask.new(:test_action_pack) do |t|
t.verbose = true
#t.warning = true
end
+
task :isolated_test do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("test/{controller,dispatch,template}/**/*_test.rb").all? do |file|
diff --git a/actionpack/lib/action_controller/abstract.rb b/actionpack/lib/action_controller/abstract.rb
index f46b91627f..d0eba253b8 100644
--- a/actionpack/lib/action_controller/abstract.rb
+++ b/actionpack/lib/action_controller/abstract.rb
@@ -2,13 +2,15 @@ require "active_support/core_ext/module/attr_internal"
require "active_support/core_ext/module/delegation"
module AbstractController
- autoload :Base, "action_controller/abstract/base"
- autoload :Benchmarker, "action_controller/abstract/benchmarker"
- autoload :Callbacks, "action_controller/abstract/callbacks"
- autoload :Helpers, "action_controller/abstract/helpers"
- autoload :Layouts, "action_controller/abstract/layouts"
- autoload :Logger, "action_controller/abstract/logger"
- autoload :Renderer, "action_controller/abstract/renderer"
+ autoload :Base, "action_controller/abstract/base"
+ autoload :Benchmarker, "action_controller/abstract/benchmarker"
+ autoload :Callbacks, "action_controller/abstract/callbacks"
+ autoload :Helpers, "action_controller/abstract/helpers"
+ autoload :Layouts, "action_controller/abstract/layouts"
+ autoload :Logger, "action_controller/abstract/logger"
+ autoload :Renderer, "action_controller/abstract/renderer"
# === Exceptions
- autoload :ActionNotFound, "action_controller/abstract/exceptions"
+ autoload :ActionNotFound, "action_controller/abstract/exceptions"
+ autoload :DoubleRenderError, "action_controller/abstract/exceptions"
+ autoload :Error, "action_controller/abstract/exceptions"
end
diff --git a/actionpack/lib/action_controller/abstract/base.rb b/actionpack/lib/action_controller/abstract/base.rb
index 87083a4d79..c3daef8759 100644
--- a/actionpack/lib/action_controller/abstract/base.rb
+++ b/actionpack/lib/action_controller/abstract/base.rb
@@ -1,53 +1,65 @@
require 'active_support/core_ext/module/attr_internal'
module AbstractController
- class Error < StandardError; end
-
- class DoubleRenderError < Error
- DEFAULT_MESSAGE = "Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like \"redirect_to(...) and return\"."
-
- def initialize(message = nil)
- super(message || DEFAULT_MESSAGE)
- end
- end
class Base
attr_internal :response_body
- attr_internal :response_obj
attr_internal :action_name
class << self
attr_reader :abstract
+ alias_method :abstract?, :abstract
+ # Define a controller as abstract. See internal_methods for more
+ # details.
def abstract!
@abstract = true
end
- alias_method :abstract?, :abstract
-
def inherited(klass)
- ::AbstractController::Base.subclasses << klass.to_s
+ ::AbstractController::Base.descendants << klass.to_s
super
end
- def subclasses
- @subclasses ||= []
+ # A list of all descendents of AbstractController::Base. This is
+ # useful for initializers which need to add behavior to all controllers.
+ def descendants
+ @descendants ||= []
end
+ # A list of all internal methods for a controller. This finds the first
+ # abstract superclass of a controller, and gets a list of all public
+ # instance methods on that abstract class. Public instance methods of
+ # a controller would normally be considered action methods, so we
+ # are removing those methods on classes declared as abstract
+ # (ActionController::Http and ActionController::Base are defined
+ # as abstract)
def internal_methods
controller = self
controller = controller.superclass until controller.abstract?
controller.public_instance_methods(true)
end
- def process(action)
- new.process(action.to_s)
- end
-
+ # The list of hidden actions to an empty Array. Defaults to an
+ # empty Array. This can be modified by other modules or subclasses
+ # to specify particular actions as hidden.
+ #
+ # ==== Returns
+ # Array[String]:: An array of method names that should not be
+ # considered actions.
def hidden_actions
[]
end
+ # A list of method names that should be considered actions. This
+ # includes all public instance methods on a controller, less
+ # any internal methods (see #internal_methods), adding back in
+ # any methods that are internal, but still exist on the class
+ # itself. Finally, #hidden_actions are removed.
+ #
+ # ==== Returns
+ # Array[String]:: A list of all methods that should be considered
+ # actions.
def action_methods
@action_methods ||=
# All public instance methods of this class, including ancestors
@@ -63,10 +75,14 @@ module AbstractController
abstract!
- def initialize
- self.response_obj = {}
- end
-
+ # Calls the action going through the entire action dispatch stack.
+ #
+ # The actual method that is called is determined by calling
+ # #method_for_action. If no method can handle the action, then an
+ # ActionNotFound error is raised.
+ #
+ # ==== Returns
+ # self
def process(action)
@_action_name = action_name = action.to_s
@@ -79,33 +95,68 @@ module AbstractController
end
private
+ # See AbstractController::Base.action_methods
def action_methods
self.class.action_methods
end
- def action_method?(action)
- action_methods.include?(action)
+ # Returns true if the name can be considered an action. This can
+ # be overridden in subclasses to modify the semantics of what
+ # can be considered an action.
+ #
+ # ==== Parameters
+ # name<String>:: The name of an action to be tested
+ #
+ # ==== Returns
+ # TrueClass, FalseClass
+ def action_method?(name)
+ action_methods.include?(name)
end
- # It is possible for respond_to?(action_name) to be false and
- # respond_to?(:action_missing) to be false if respond_to_action?
- # is overridden in a subclass. For instance, ActionController::Base
- # overrides it to include the case where a template matching the
- # action_name is found.
+ # Call the action. Override this in a subclass to modify the
+ # behavior around processing an action. This, and not #process,
+ # is the intended way to override action dispatching.
def process_action(method_name)
send_action(method_name)
end
+ # Actually call the method associated with the action. Override
+ # this method if you wish to change how action methods are called,
+ # not to add additional behavior around it. For example, you would
+ # override #send_action if you want to inject arguments into the
+ # method.
alias send_action send
+ # If the action name was not found, but a method called "action_missing"
+ # was found, #method_for_action will return "_handle_action_missing".
+ # This method calls #action_missing with the current action name.
def _handle_action_missing
action_missing(@_action_name)
end
- # Override this to change the conditions that will raise an
- # ActionNotFound error. If you accept a difference case,
- # you must handle it by also overriding process_action and
- # handling the case.
+ # Takes an action name and returns the name of the method that will
+ # handle the action. In normal cases, this method returns the same
+ # name as it receives. By default, if #method_for_action receives
+ # a name that is not an action, it will look for an #action_missing
+ # method and return "_handle_action_missing" if one is found.
+ #
+ # Subclasses may override this method to add additional conditions
+ # that should be considered an action. For instance, an HTTP controller
+ # with a template matching the action name is considered to exist.
+ #
+ # If you override this method to handle additional cases, you may
+ # also provide a method (like _handle_method_missing) to handle
+ # the case.
+ #
+ # If none of these conditions are true, and method_for_action
+ # returns nil, an ActionNotFound exception will be raised.
+ #
+ # ==== Parameters
+ # action_name<String>:: An action name to find a method name for
+ #
+ # ==== Returns
+ # String:: The name of the method that handles the action
+ # nil:: No method name could be found. Raise ActionNotFound.
def method_for_action(action_name)
if action_method?(action_name) then action_name
elsif respond_to?(:action_missing, true) then "_handle_action_missing"
diff --git a/actionpack/lib/action_controller/abstract/benchmarker.rb b/actionpack/lib/action_controller/abstract/benchmarker.rb
index 07294cede3..58e9564c2f 100644
--- a/actionpack/lib/action_controller/abstract/benchmarker.rb
+++ b/actionpack/lib/action_controller/abstract/benchmarker.rb
@@ -5,6 +5,16 @@ module AbstractController
include Logger
module ClassMethods
+ # Execute the passed in block, timing the duration of the block in ms.
+ #
+ # ==== Parameters
+ # title<#to_s>:: The title of block to benchmark
+ # log_level<Integer>:: A valid log level. Defaults to Logger::DEBUG
+ # use_silence<TrueClass, FalseClass>:: Whether or not to silence the
+ # logger for the duration of the block.
+ #
+ # ==== Returns
+ # Object:: The result of the block
def benchmark(title, log_level = ::Logger::DEBUG, use_silence = true)
if logger && logger.level >= log_level
result = nil
diff --git a/actionpack/lib/action_controller/abstract/callbacks.rb b/actionpack/lib/action_controller/abstract/callbacks.rb
index affe053bac..0d5161c80e 100644
--- a/actionpack/lib/action_controller/abstract/callbacks.rb
+++ b/actionpack/lib/action_controller/abstract/callbacks.rb
@@ -2,12 +2,17 @@ module AbstractController
module Callbacks
extend ActiveSupport::Concern
+ # Uses ActiveSupport::NewCallbacks as the base functionality. For
+ # more details on the whole callback system, read the documentation
+ # for ActiveSupport::NewCallbacks.
include ActiveSupport::NewCallbacks
included do
define_callbacks :process_action, "response_body"
end
+ # Override AbstractController::Base's process_action to run the
+ # process_action callbacks around the normal behavior.
def process_action(method_name)
_run_process_action_callbacks(method_name) do
super
@@ -15,6 +20,17 @@ module AbstractController
end
module ClassMethods
+ # If :only or :accept are used, convert the options into the
+ # primitive form (:per_key) used by ActiveSupport::Callbacks.
+ # The basic idea is that :only => :index gets converted to
+ # :if => proc {|c| c.action_name == "index" }, but that the
+ # proc is only evaluated once per action for the lifetime of
+ # a Rails process.
+ #
+ # ==== Options
+ # :only<#to_s>:: The callback should be run only for this action
+ # :except<#to_s>:: The callback should be run for all actions
+ # except this action
def _normalize_callback_options(options)
if only = options[:only]
only = Array(only).map {|o| "action_name == '#{o}'"}.join(" || ")
@@ -26,41 +42,69 @@ module AbstractController
end
end
+ # Skip before, after, and around filters matching any of the names
+ #
+ # ==== Parameters
+ # *names<Object>:: A list of valid names that could be used for
+ # callbacks. Note that skipping uses Ruby equality, so it's
+ # impossible to skip a callback defined using an anonymous proc
+ # using #skip_filter
def skip_filter(*names, &blk)
- skip_before_filter(*names, &blk)
- skip_after_filter(*names, &blk)
- skip_around_filter(*names, &blk)
+ skip_before_filter(*names)
+ skip_after_filter(*names)
+ skip_around_filter(*names)
end
+ # Take callback names and an optional callback proc, normalize them,
+ # then call the block with each callback. This allows us to abstract
+ # the normalization across several methods that use it.
+ #
+ # ==== Parameters
+ # callbacks<Array[*Object, Hash]>:: A list of callbacks, with an optional
+ # options hash as the last parameter.
+ # block<Proc>:: A proc that should be added to the callbacks.
+ #
+ # ==== Block Parameters
+ # name<Symbol>:: The callback to be added
+ # options<Hash>:: A list of options to be used when adding the callback
+ def _insert_callbacks(callbacks, block)
+ options = callbacks.last.is_a?(Hash) ? callbacks.pop : {}
+ _normalize_callback_options(options)
+ callbacks.push(block) if block
+ callbacks.each do |callback|
+ yield callback, options
+ end
+ end
+
+ # set up before_filter, prepend_before_filter, skip_before_filter, etc.
+ # for each of before, after, and around.
[:before, :after, :around].each do |filter|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ # Append a before, after or around filter. See _insert_callbacks
+ # for details on the allowed parameters.
def #{filter}_filter(*names, &blk)
- options = names.last.is_a?(Hash) ? names.pop : {}
- _normalize_callback_options(options)
- names.push(blk) if block_given?
- names.each do |name|
- process_action_callback(:#{filter}, name, options)
+ _insert_callbacks(names, blk) do |name, options|
+ set_callback(:process_action, :#{filter}, name, options)
end
end
+ # Prepend a before, after or around filter. See _insert_callbacks
+ # for details on the allowed parameters.
def prepend_#{filter}_filter(*names, &blk)
- options = names.last.is_a?(Hash) ? names.pop : {}
- _normalize_callback_options(options)
- names.push(blk) if block_given?
- names.each do |name|
- process_action_callback(:#{filter}, name, options.merge(:prepend => true))
+ _insert_callbacks(names, blk) do |name, options|
+ set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true))
end
end
+ # Skip a before, after or around filter. See _insert_callbacks
+ # for details on the allowed parameters.
def skip_#{filter}_filter(*names, &blk)
- options = names.last.is_a?(Hash) ? names.pop : {}
- _normalize_callback_options(options)
- names.push(blk) if block_given?
- names.each do |name|
- skip_process_action_callback(:#{filter}, name, options)
+ _insert_callbacks(names, blk) do |name, options|
+ skip_callback(:process_action, :#{filter}, name, options)
end
end
+ # *_filter is the same as append_*_filter
alias_method :append_#{filter}_filter, :#{filter}_filter
RUBY_EVAL
end
diff --git a/actionpack/lib/action_controller/abstract/exceptions.rb b/actionpack/lib/action_controller/abstract/exceptions.rb
index 2f6c55f068..b671516de1 100644
--- a/actionpack/lib/action_controller/abstract/exceptions.rb
+++ b/actionpack/lib/action_controller/abstract/exceptions.rb
@@ -1,3 +1,12 @@
module AbstractController
+ class Error < StandardError; end
class ActionNotFound < StandardError; end
+
+ class DoubleRenderError < Error
+ DEFAULT_MESSAGE = "Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like \"redirect_to(...) and return\"."
+
+ def initialize(message = nil)
+ super(message || DEFAULT_MESSAGE)
+ end
+ end
end
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb
index dd58c7cb64..28bdda4a75 100644
--- a/actionpack/lib/action_controller/abstract/renderer.rb
+++ b/actionpack/lib/action_controller/abstract/renderer.rb
@@ -14,10 +14,29 @@ module AbstractController
self._view_paths ||= ActionView::PathSet.new
end
+ # An instance of a view class. The default view class is ActionView::Base
+ #
+ # The view class must have the following methods:
+ # initialize[paths, assigns_for_first_render, controller]
+ # paths<Array[ViewPath]>:: A list of resolvers to look for templates in
+ # controller<AbstractController::Base> A controller
+ # _render_partial_from_controller[options]
+ # options<Hash>:: see _render_partial in ActionView::Base
+ # _render_template_from_controller[template, layout, options, partial]
+ # template<ActionView::Template>:: The template to render
+ # layout<ActionView::Template>:: The layout to render around the template
+ # options<Hash>:: See _render_template_with_layout in ActionView::Base
+ # partial<Boolean>:: Whether or not the template to render is a partial
+ # _partial:: If a partial, rather than a template, was rendered, return
+ # the partial.
+ #
+ # Override this method in a to change the default behavior.
def _action_view
@_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self)
end
+ # Mostly abstracts the fact that calling render twice is a DoubleRenderError.
+ # Delegates render_to_body and sticks the result in self.response_body.
def render(*args)
if response_body
raise AbstractController::DoubleRenderError, "OMG"
@@ -27,9 +46,10 @@ module AbstractController
end
# Raw rendering of a template to a Rack-compatible body.
- # ====
- # @option _prefix<String> The template's path prefix
- # @option _layout<String> The relative path to the layout template to use
+ #
+ # ==== Options
+ # _partial_object<Object>:: The object that is being rendered. If this
+ # exists, we are in the special case of rendering an object as a partial.
#
# :api: plugin
def render_to_body(options = {})
@@ -42,21 +62,27 @@ module AbstractController
end
end
- # Raw rendering of a template to a string.
- # ====
- # @option _prefix<String> The template's path prefix
- # @option _layout<String> The relative path to the layout template to use
+ # Raw rendering of a template to a string. Just convert the results of
+ # render_to_body into a String.
#
# :api: plugin
def render_to_string(options = {})
AbstractController::Renderer.body_to_s(render_to_body(options))
end
+ # Renders the template from an object.
+ #
+ # ==== Options
+ # _template<ActionView::Template>:: The template to render
+ # _layout<ActionView::Template>:: The layout to wrap the template in (optional)
+ # _partial<TrueClass, FalseClass>:: Whether or not the template to be rendered is a partial
def _render_template(options)
_action_view._render_template_from_controller(options[:_template], options[:_layout], options, options[:_partial])
end
- def view_paths()
+ # The list of view paths for this controller. See ActionView::ViewPathSet for
+ # more details about writing custom view paths.
+ def view_paths
_view_paths
end
@@ -73,6 +99,15 @@ module AbstractController
end
private
+ # Take in a set of options and determine the template to render
+ #
+ # ==== Options
+ # _template<ActionView::Template>:: If this is provided, the search is over
+ # _template_name<#to_s>:: The name of the template to look up. Otherwise,
+ # use the current action name.
+ # _prefix<String>:: The prefix to look inside of. In a file system, this corresponds
+ # to a directory.
+ # _partial<TrueClass, FalseClass>:: Whether or not the file to look up is a partial
def _determine_template(options)
name = (options[:_template_name] || action_name).to_s
@@ -82,18 +117,36 @@ module AbstractController
end
module ClassMethods
+ # Append a path to the list of view paths for this controller.
+ #
+ # ==== Parameters
+ # path<String, ViewPath>:: If a String is provided, it gets converted into
+ # the default view path. You may also provide a custom view path
+ # (see ActionView::ViewPathSet for more information)
def append_view_path(path)
self.view_paths << path
end
+ # Prepend a path to the list of view paths for this controller.
+ #
+ # ==== Parameters
+ # path<String, ViewPath>:: If a String is provided, it gets converted into
+ # the default view path. You may also provide a custom view path
+ # (see ActionView::ViewPathSet for more information)
def prepend_view_path(path)
self.view_paths.unshift(path)
end
+ # A list of all of the default view paths for this controller.
def view_paths
self._view_paths
end
+ # Set the view paths.
+ #
+ # ==== Parameters
+ # paths<ViewPathSet, Object>:: If a ViewPathSet is provided, use that;
+ # otherwise, process the parameter into a ViewPathSet.
def view_paths=(paths)
self._view_paths = paths.is_a?(ActionView::PathSet) ?
paths : ActionView::Base.process_view_paths(paths)
diff --git a/actionpack/lib/action_controller/base/http_authentication.rb b/actionpack/lib/action_controller/base/http_authentication.rb
index 2893290efb..2519f55269 100644
--- a/actionpack/lib/action_controller/base/http_authentication.rb
+++ b/actionpack/lib/action_controller/base/http_authentication.rb
@@ -185,7 +185,7 @@ module ActionController
request.env['REDIRECT_X_HTTP_AUTHORIZATION']
end
- # Raises error unless the request credentials response value matches the expected value.
+ # Returns false unless the request credentials response value matches the expected value.
# First try the password as a ha1 digest password. If this fails, then try it as a plain
# text password.
def validate_digest_response(request, realm, &password_procedure)
@@ -194,6 +194,8 @@ module ActionController
if valid_nonce && realm == credentials[:realm] && opaque == credentials[:opaque]
password = password_procedure.call(credentials[:username])
+ return false unless password
+
method = request.env['rack.methodoverride.original_method'] || request.env['REQUEST_METHOD']
[true, false].any? do |password_is_ha1|
diff --git a/actionpack/lib/action_controller/new_base/base.rb b/actionpack/lib/action_controller/new_base/base.rb
index d7b65d37fa..e8fc153578 100644
--- a/actionpack/lib/action_controller/new_base/base.rb
+++ b/actionpack/lib/action_controller/new_base/base.rb
@@ -39,7 +39,7 @@ module ActionController
# TODO: Extract into its own module
# This should be moved together with other normalizing behavior
module ImplicitRender
- def send_action(method_name)
+ def send_action(*)
ret = super
default_render unless performed?
ret
diff --git a/actionpack/lib/action_controller/routing/resources.rb b/actionpack/lib/action_controller/routing/resources.rb
index 05c782d226..2dee0a3d87 100644
--- a/actionpack/lib/action_controller/routing/resources.rb
+++ b/actionpack/lib/action_controller/routing/resources.rb
@@ -150,9 +150,9 @@ module ActionController
end
if only
- @allowed_actions[:only] = Array(only).map(&:to_sym)
+ @allowed_actions[:only] = Array(only).map {|a| a.to_sym }
elsif except
- @allowed_actions[:except] = Array(except).map(&:to_sym)
+ @allowed_actions[:except] = Array(except).map {|a| a.to_sym }
end
end
diff --git a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
index 8f448970d9..1d9efc2b36 100644
--- a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
+++ b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
@@ -1,3 +1,4 @@
+require "active_support/core_ext/kernel/requires"
begin
require_library_or_gem 'memcache'
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
index bfff307669..036deec6d2 100644
--- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -1,3 +1,5 @@
+require "active_support/core_ext/exception"
+
module ActionDispatch
class ShowExceptions
include StatusCodes
diff --git a/actionpack/lib/action_view/helpers.rb b/actionpack/lib/action_view/helpers.rb
index 693ab7c2e0..97fa2d80e9 100644
--- a/actionpack/lib/action_view/helpers.rb
+++ b/actionpack/lib/action_view/helpers.rb
@@ -11,7 +11,7 @@ module ActionView #:nodoc:
autoload :FormHelper, 'action_view/helpers/form_helper'
autoload :FormOptionsHelper, 'action_view/helpers/form_options_helper'
autoload :FormTagHelper, 'action_view/helpers/form_tag_helper'
- autoload :JavascriptHelper, 'action_view/helpers/javascript_helper'
+ autoload :JavaScriptHelper, 'action_view/helpers/javascript_helper'
autoload :NumberHelper, 'action_view/helpers/number_helper'
autoload :PrototypeHelper, 'action_view/helpers/prototype_helper'
autoload :RecordIdentificationHelper, 'action_view/helpers/record_identification_helper'
diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb
index b4b9f6e34b..8b70200654 100644
--- a/actionpack/lib/action_view/helpers/active_record_helper.rb
+++ b/actionpack/lib/action_view/helpers/active_record_helper.rb
@@ -1,6 +1,8 @@
require 'cgi'
require 'action_view/helpers/form_helper'
require 'active_support/core_ext/class/attribute_accessors'
+require 'active_support/core_ext/enumerable'
+require 'active_support/core_ext/kernel/reporting'
module ActionView
class Base
diff --git a/actionpack/lib/action_view/helpers/benchmark_helper.rb b/actionpack/lib/action_view/helpers/benchmark_helper.rb
index 61c2cecb04..c13a069a35 100644
--- a/actionpack/lib/action_view/helpers/benchmark_helper.rb
+++ b/actionpack/lib/action_view/helpers/benchmark_helper.rb
@@ -1,4 +1,4 @@
-require 'benchmark'
+require 'active_support/core_ext/benchmark'
module ActionView
module Helpers
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index beef661a37..8ecec87b10 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -3,6 +3,7 @@ require 'action_view/helpers/date_helper'
require 'action_view/helpers/tag_helper'
require 'action_view/helpers/form_tag_helper'
require 'active_support/core_ext/class/inheritable_attributes'
+require 'active_support/core_ext/hash/slice'
module ActionView
module Helpers
@@ -494,7 +495,8 @@ module ActionView
# Returns a label tag tailored for labelling an input field for a specified attribute (identified by +method+) on an object
# assigned to the template (identified by +object+). The text of label will default to the attribute name unless you specify
# it explicitly. Additional options on the label tag can be passed as a hash with +options+. These options will be tagged
- # onto the HTML as an HTML element attribute as in the example shown.
+ # onto the HTML as an HTML element attribute as in the example shown, except for the <tt>:value</tt> option, which is designed to
+ # target labels for radio_button tags (where the value is used in the ID of the input tag).
#
# ==== Examples
# label(:post, :title)
@@ -506,6 +508,9 @@ module ActionView
# label(:post, :title, "A short title", :class => "title_label")
# # => <label for="post_title" class="title_label">A short title</label>
#
+ # label(:post, :privacy, "Public Post", :value => "public")
+ # # => <label for="post_privacy_public">Public Post</label>
+ #
def label(object_name, method, text = nil, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_label_tag(text, options)
end
@@ -728,8 +733,9 @@ module ActionView
def to_label_tag(text = nil, options = {})
options = options.stringify_keys
+ tag_value = options.delete("value")
name_and_id = options.dup
- add_default_name_and_id(name_and_id)
+ add_default_name_and_id_for_value(tag_value, name_and_id)
options.delete("index")
options["for"] ||= name_and_id["id"]
content = (text.blank? ? nil : text.to_s) || method_name.humanize
@@ -761,11 +767,7 @@ module ActionView
checked = self.class.radio_button_checked?(value(object), tag_value)
end
options["checked"] = "checked" if checked
- pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase
- options["id"] ||= defined?(@auto_index) ?
- "#{tag_id_with_index(@auto_index)}_#{pretty_tag_value}" :
- "#{tag_id}_#{pretty_tag_value}"
- add_default_name_and_id(options)
+ add_default_name_and_id_for_value(tag_value, options)
tag("input", options)
end
@@ -866,6 +868,17 @@ module ActionView
end
private
+ def add_default_name_and_id_for_value(tag_value, options)
+ if tag_value
+ pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase
+ specified_id = options["id"]
+ add_default_name_and_id(options)
+ options["id"] += "_#{pretty_tag_value}" unless specified_id
+ else
+ add_default_name_and_id(options)
+ end
+ end
+
def add_default_name_and_id(options)
if options.has_key?("index")
options["name"] ||= tag_name_with_index(options["index"])
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index c96b1fc8d2..8ab78e7bc6 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -1,5 +1,6 @@
require 'cgi'
require 'action_view/helpers/tag_helper'
+require 'active_support/core_ext/object/returning'
module ActionView
module Helpers
@@ -257,7 +258,7 @@ module ActionView
options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
end
- content_tag :textarea, content, { "name" => name, "id" => name }.update(options.stringify_keys)
+ content_tag :textarea, content, { "name" => name, "id" => sanitize_to_id(name) }.update(options.stringify_keys)
end
# Creates a check box form input tag.
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index c0f5df3468..624b537ad2 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -1,6 +1,7 @@
require 'set'
require 'active_support/json'
require 'active_support/core_ext/object/extending'
+require 'active_support/core_ext/object/returning'
module ActionView
module Helpers
@@ -1175,7 +1176,7 @@ module ActionView
class JavaScriptVariableProxy < JavaScriptProxy #:nodoc:
def initialize(generator, variable)
- @variable = variable
+ @variable = ::ActiveSupport::JSON::Variable.new(variable)
@empty = true # only record lines if we have to. gets rid of unnecessary linebreaks
super(generator)
end
@@ -1186,7 +1187,7 @@ module ActionView
true
end
- def rails_to_json(*)
+ def as_json(options = nil)
@variable
end
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 36e0a78e93..de864f453c 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -1,4 +1,5 @@
require 'action_view/helpers/javascript_helper'
+require 'active_support/core_ext/hash/keys'
module ActionView
module Helpers #:nodoc:
@@ -221,9 +222,9 @@ module ActionView
html_options = args.second
concat(link_to(capture(&block), options, html_options))
else
- name = args.first
- options = args.second || {}
- html_options = args.third
+ name = args[0]
+ options = args[1] || {}
+ html_options = args[2]
url = url_for(options)
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb
index a06e80b294..6e5093c5bd 100644
--- a/actionpack/lib/action_view/template/error.rb
+++ b/actionpack/lib/action_view/template/error.rb
@@ -1,3 +1,5 @@
+require "active_support/core_ext/enumerable"
+
module ActionView
# The TemplateError exception is raised when the compilation of the template fails. This exception then gathers a
# bunch of intimate details and uses it to report a very precise exception message.
diff --git a/actionpack/test/abstract_controller/abstract_controller_test.rb b/actionpack/test/abstract_controller/abstract_controller_test.rb
index 9c028e7d1e..c7eaaeb4ba 100644
--- a/actionpack/test/abstract_controller/abstract_controller_test.rb
+++ b/actionpack/test/abstract_controller/abstract_controller_test.rb
@@ -19,7 +19,7 @@ module AbstractController
class TestBasic < ActiveSupport::TestCase
test "dispatching works" do
- result = Me.process(:index)
+ result = Me.new.process(:index)
assert_equal "Hello world", result.response_body
end
end
@@ -68,27 +68,27 @@ module AbstractController
class TestRenderer < ActiveSupport::TestCase
test "rendering templates works" do
- result = Me2.process(:index)
+ result = Me2.new.process(:index)
assert_equal "Hello from index.erb", result.response_body
end
test "rendering passes ivars to the view" do
- result = Me2.process(:action_with_ivars)
+ result = Me2.new.process(:action_with_ivars)
assert_equal "Hello from index_with_ivars.erb", result.response_body
end
test "rendering with no template name" do
- result = Me2.process(:naked_render)
+ result = Me2.new.process(:naked_render)
assert_equal "Hello from naked_render.erb", result.response_body
end
test "rendering to a rack body" do
- result = Me2.process(:rendering_to_body)
+ result = Me2.new.process(:rendering_to_body)
assert_equal "Hello from naked_render.erb", result.response_body
end
test "rendering to a string" do
- result = Me2.process(:rendering_to_string)
+ result = Me2.new.process(:rendering_to_string)
assert_equal "Hello from naked_render.erb", result.response_body
end
end
@@ -120,12 +120,12 @@ module AbstractController
class TestPrefixedViews < ActiveSupport::TestCase
test "templates are located inside their 'prefix' folder" do
- result = Me3.process(:index)
+ result = Me3.new.process(:index)
assert_equal "Hello from me3/index.erb", result.response_body
end
test "templates included their format" do
- result = Me3.process(:formatted)
+ result = Me3.new.process(:formatted)
assert_equal "Hello from me3/formatted.html.erb", result.response_body
end
end
@@ -173,7 +173,7 @@ module AbstractController
class TestLayouts < ActiveSupport::TestCase
test "layouts are included" do
- result = Me4.process(:index)
+ result = Me4.new.process(:index)
assert_equal "Me4 Enter : Hello from me4/index.erb : Exit", result.response_body
end
end
@@ -210,7 +210,7 @@ module AbstractController
class TestRespondToAction < ActiveSupport::TestCase
def assert_dispatch(klass, body = "success", action = :index)
- response = klass.process(action).response_body
+ response = klass.new.process(action).response_body
assert_equal body, response
end
@@ -219,7 +219,7 @@ module AbstractController
end
test "raises ActionNotFound when method does not exist and action_missing is not defined" do
- assert_raise(ActionNotFound) { DefaultRespondToActionController.process(:fail) }
+ assert_raise(ActionNotFound) { DefaultRespondToActionController.new.process(:fail) }
end
test "dispatches to action_missing when method does not exist and action_missing is defined" do
@@ -231,7 +231,7 @@ module AbstractController
end
test "raises ActionNotFound if method is defined but respond_to_action? returns false" do
- assert_raise(ActionNotFound) { RespondToActionController.process(:fail) }
+ assert_raise(ActionNotFound) { RespondToActionController.new.process(:fail) }
end
end
diff --git a/actionpack/test/abstract_controller/callbacks_test.rb b/actionpack/test/abstract_controller/callbacks_test.rb
index 1de60868c3..817f60f7d1 100644
--- a/actionpack/test/abstract_controller/callbacks_test.rb
+++ b/actionpack/test/abstract_controller/callbacks_test.rb
@@ -8,7 +8,7 @@ module AbstractController
end
class Callback1 < ControllerWithCallbacks
- process_action_callback :before, :first
+ set_callback :process_action, :before, :first
def first
@text = "Hello world"
@@ -21,7 +21,7 @@ module AbstractController
class TestCallbacks < ActiveSupport::TestCase
test "basic callbacks work" do
- result = Callback1.process(:index)
+ result = Callback1.new.process(:index)
assert_equal "Hello world", result.response_body
end
end
@@ -52,17 +52,17 @@ module AbstractController
class TestCallbacks < ActiveSupport::TestCase
test "before_filter works" do
- result = Callback2.process(:index)
+ result = Callback2.new.process(:index)
assert_equal "Hello world", result.response_body
end
test "after_filter works" do
- result = Callback2.process(:index)
+ result = Callback2.new.process(:index)
assert_equal "Goodbye", result.instance_variable_get("@second")
end
test "around_filter works" do
- result = Callback2.process(:index)
+ result = Callback2.new.process(:index)
assert_equal "FIRSTSECOND", result.instance_variable_get("@aroundz")
end
end
@@ -83,12 +83,12 @@ module AbstractController
class TestCallbacks < ActiveSupport::TestCase
test "before_filter works with procs" do
- result = Callback3.process(:index)
+ result = Callback3.new.process(:index)
assert_equal "Hello world", result.response_body
end
test "after_filter works with procs" do
- result = Callback3.process(:index)
+ result = Callback3.new.process(:index)
assert_equal "Goodbye", result.instance_variable_get("@second")
end
end
@@ -118,17 +118,17 @@ module AbstractController
class TestCallbacks < ActiveSupport::TestCase
test "when :only is specified, a before filter is triggered on that action" do
- result = CallbacksWithConditions.process(:index)
+ result = CallbacksWithConditions.new.process(:index)
assert_equal "Hello, World", result.response_body
end
test "when :only is specified, a before filter is not triggered on other actions" do
- result = CallbacksWithConditions.process(:sekrit_data)
+ result = CallbacksWithConditions.new.process(:sekrit_data)
assert_equal "true", result.response_body
end
test "when :except is specified, an after filter is not triggered on that action" do
- result = CallbacksWithConditions.process(:index)
+ result = CallbacksWithConditions.new.process(:index)
assert_nil result.instance_variable_get("@authenticated")
end
end
@@ -158,17 +158,17 @@ module AbstractController
class TestCallbacks < ActiveSupport::TestCase
test "when :only is specified with an array, a before filter is triggered on that action" do
- result = CallbacksWithArrayConditions.process(:index)
+ result = CallbacksWithArrayConditions.new.process(:index)
assert_equal "Hello, World", result.response_body
end
test "when :only is specified with an array, a before filter is not triggered on other actions" do
- result = CallbacksWithArrayConditions.process(:sekrit_data)
+ result = CallbacksWithArrayConditions.new.process(:sekrit_data)
assert_equal "true", result.response_body
end
test "when :except is specified with an array, an after filter is not triggered on that action" do
- result = CallbacksWithArrayConditions.process(:index)
+ result = CallbacksWithArrayConditions.new.process(:index)
assert_nil result.instance_variable_get("@authenticated")
end
end
@@ -183,12 +183,12 @@ module AbstractController
class TestCallbacks < ActiveSupport::TestCase
test "when a callback is modified in a child with :only, it works for the :only action" do
- result = ChangedConditions.process(:index)
+ result = ChangedConditions.new.process(:index)
assert_equal "Hello world", result.response_body
end
test "when a callback is modified in a child with :only, it does not work for other actions" do
- result = ChangedConditions.process(:not_index)
+ result = ChangedConditions.new.process(:not_index)
assert_equal "", result.response_body
end
end
@@ -207,7 +207,7 @@ module AbstractController
class TestHalting < ActiveSupport::TestCase
test "when a callback sets the response body, the action should not be invoked" do
- result = SetsResponseBody.process(:index)
+ result = SetsResponseBody.new.process(:index)
assert_equal "Success", result.response_body
end
end
diff --git a/actionpack/test/abstract_controller/helper_test.rb b/actionpack/test/abstract_controller/helper_test.rb
index f91aefe606..0a2535f834 100644
--- a/actionpack/test/abstract_controller/helper_test.rb
+++ b/actionpack/test/abstract_controller/helper_test.rb
@@ -34,7 +34,7 @@ module AbstractController
class TestHelpers < ActiveSupport::TestCase
def test_helpers
- result = MyHelpers1.process(:index)
+ result = MyHelpers1.new.process(:index)
assert_equal "Hello World : Included", result.response_body
end
end
diff --git a/actionpack/test/abstract_controller/layouts_test.rb b/actionpack/test/abstract_controller/layouts_test.rb
index d3440c3de0..4b66f063f3 100644
--- a/actionpack/test/abstract_controller/layouts_test.rb
+++ b/actionpack/test/abstract_controller/layouts_test.rb
@@ -142,7 +142,7 @@ module AbstractControllerTests
end
# TODO Move to bootloader
- AbstractController::Base.subclasses.each do |klass|
+ AbstractController::Base.descendants.each do |klass|
klass = klass.constantize
next unless klass < AbstractController::Layouts
klass.class_eval do
@@ -152,70 +152,70 @@ module AbstractControllerTests
class TestBase < ActiveSupport::TestCase
test "when no layout is specified, and no default is available, render without a layout" do
- result = Blank.process(:index)
+ result = Blank.new.process(:index)
assert_equal "Hello blank!", result.response_body
end
test "when layout is specified as a string, render with that layout" do
- result = WithString.process(:index)
+ result = WithString.new.process(:index)
assert_equal "With String Hello string!", result.response_body
end
test "when layout is specified as a string, but the layout is missing, raise an exception" do
- assert_raises(ActionView::MissingTemplate) { WithMissingLayout.process(:index) }
+ assert_raises(ActionView::MissingTemplate) { WithMissingLayout.new.process(:index) }
end
test "when layout is specified as false, do not use a layout" do
- result = WithFalseLayout.process(:index)
+ result = WithFalseLayout.new.process(:index)
assert_equal "Hello false!", result.response_body
end
test "when layout is specified as nil, do not use a layout" do
- result = WithNilLayout.process(:index)
+ result = WithNilLayout.new.process(:index)
assert_equal "Hello nil!", result.response_body
end
test "when layout is specified as a symbol, call the requested method and use the layout returned" do
- result = WithSymbol.process(:index)
+ result = WithSymbol.new.process(:index)
assert_equal "OMGHI2U Hello symbol!", result.response_body
end
test "when layout is specified as a symbol and the method returns nil, don't use a layout" do
- result = WithSymbolReturningNil.process(:index)
+ result = WithSymbolReturningNil.new.process(:index)
assert_equal "Hello nilz!", result.response_body
end
test "when the layout is specified as a symbol and the method doesn't exist, raise an exception" do
- assert_raises(NoMethodError, /:nilz/) { WithSymbolAndNoMethod.process(:index) }
+ assert_raises(NoMethodError, /:nilz/) { WithSymbolAndNoMethod.new.process(:index) }
end
test "when the layout is specified as a symbol and the method returns something besides a string/false/nil, raise an exception" do
- assert_raises(ArgumentError) { WithSymbolReturningObj.process(:index) }
+ assert_raises(ArgumentError) { WithSymbolReturningObj.new.process(:index) }
end
test "when a child controller does not have a layout, use the parent controller layout" do
- result = WithStringChild.process(:index)
+ result = WithStringChild.new.process(:index)
assert_equal "With String Hello string!", result.response_body
end
test "when a child controller has specified a layout, use that layout and not the parent controller layout" do
- result = WithStringOverriddenChild.process(:index)
+ result = WithStringOverriddenChild.new.process(:index)
assert_equal "With Override Hello string!", result.response_body
end
test "when a child controller has an implied layout, use that layout and not the parent controller layout" do
- result = WithStringImpliedChild.process(:index)
+ result = WithStringImpliedChild.new.process(:index)
assert_equal "With Implied Hello string!", result.response_body
end
test "when a child controller specifies layout nil, do not use the parent layout" do
- result = WithNilChild.process(:index)
+ result = WithNilChild.new.process(:index)
assert_equal "Hello string!", result.response_body
end
test "when a grandchild has no layout specified, the child has an implied layout, and the " \
"parent has specified a layout, use the child controller layout" do
- result = WithChildOfImplied.process(:index)
+ result = WithChildOfImplied.new.process(:index)
assert_equal "With Implied Hello string!", result.response_body
end
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb
index df0a9dbfb0..b930ff4997 100644
--- a/actionpack/test/controller/filters_test.rb
+++ b/actionpack/test/controller/filters_test.rb
@@ -876,10 +876,12 @@ class YieldingAroundFiltersTest < ActionController::TestCase
assert_raise(After) { test_process(controller,'raises_after') }
end
- def test_with_method
- controller = ControllerWithFilterMethod
- assert_nothing_raised { test_process(controller,'no_raise') }
- assert_raise(After) { test_process(controller,'raises_after') }
+ for_tag(:old_base) do
+ def test_with_method
+ controller = ControllerWithFilterMethod
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ assert_raise(After) { test_process(controller,'raises_after') }
+ end
end
def test_with_proc
diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb
index 5b9feb3630..342cbfbcd3 100644
--- a/actionpack/test/controller/helper_test.rb
+++ b/actionpack/test/controller/helper_test.rb
@@ -127,7 +127,7 @@ class HelperTest < Test::Unit::TestCase
end
def test_all_helpers
- methods = AllHelpersController.master_helper_module.instance_methods.map(&:to_s)
+ methods = AllHelpersController.master_helper_module.instance_methods.map {|m| m.to_s}
# abc_helper.rb
assert methods.include?('bare_a')
@@ -171,11 +171,11 @@ class HelperTest < Test::Unit::TestCase
private
def expected_helper_methods
- TestHelper.instance_methods.map(&:to_s)
+ TestHelper.instance_methods.map {|m| m.to_s }
end
def master_helper_methods
- @controller_class.master_helper_module.instance_methods.map(&:to_s)
+ @controller_class.master_helper_module.instance_methods.map {|m| m.to_s }
end
def missing_methods
diff --git a/actionpack/test/controller/http_digest_authentication_test.rb b/actionpack/test/controller/http_digest_authentication_test.rb
index 15a11395bb..58f3b88075 100644
--- a/actionpack/test/controller/http_digest_authentication_test.rb
+++ b/actionpack/test/controller/http_digest_authentication_test.rb
@@ -76,6 +76,15 @@ class HttpDigestAuthenticationTest < ActionController::TestCase
assert_equal 'SuperSecret', credentials[:realm]
end
+ test "authentication request with nil credentials" do
+ @request.env['HTTP_AUTHORIZATION'] = encode_credentials(:username => nil, :password => nil)
+ get :index
+
+ assert_response :unauthorized
+ assert_equal "HTTP Digest: Access denied.\n", @response.body, "Authentication didn't fail for request"
+ assert_not_equal 'Hello Secret', @response.body, "Authentication didn't fail for request"
+ end
+
test "authentication request with invalid password" do
@request.env['HTTP_AUTHORIZATION'] = encode_credentials(:username => 'pretty', :password => 'foo')
get :display
@@ -168,6 +177,11 @@ class HttpDigestAuthenticationTest < ActionController::TestCase
assert_equal 'Definitely Maybe', @response.body
end
+ test "validate_digest_response should fail with nil returning password_procedure" do
+ @request.env['HTTP_AUTHORIZATION'] = encode_credentials(:username => nil, :password => nil)
+ assert !ActionController::HttpAuthentication::Digest.validate_digest_response(@request, "SuperSecret"){nil}
+ end
+
private
def encode_credentials(options)
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 6b08a04b10..c2acc03a1b 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -1623,13 +1623,13 @@ class RouteSetTest < Test::Unit::TestCase
set.draw { |m| m.connect ':controller/:action/:id' }
path, extras = set.generate_extras(:controller => "foo", :action => "bar", :id => 15, :this => "hello", :that => "world")
assert_equal "/foo/bar/15", path
- assert_equal %w(that this), extras.map(&:to_s).sort
+ assert_equal %w(that this), extras.map { |e| e.to_s }.sort
end
def test_extra_keys
set.draw { |m| m.connect ':controller/:action/:id' }
extras = set.extra_keys(:controller => "foo", :action => "bar", :id => 15, :this => "hello", :that => "world")
- assert_equal %w(that this), extras.map(&:to_s).sort
+ assert_equal %w(that this), extras.map { |e| e.to_s }.sort
end
def test_generate_extras_not_first
@@ -1639,7 +1639,7 @@ class RouteSetTest < Test::Unit::TestCase
end
path, extras = set.generate_extras(:controller => "foo", :action => "bar", :id => 15, :this => "hello", :that => "world")
assert_equal "/foo/bar/15", path
- assert_equal %w(that this), extras.map(&:to_s).sort
+ assert_equal %w(that this), extras.map { |e| e.to_s }.sort
end
def test_generate_not_first
@@ -1656,7 +1656,7 @@ class RouteSetTest < Test::Unit::TestCase
map.connect ':controller/:action/:id'
end
extras = set.extra_keys(:controller => "foo", :action => "bar", :id => 15, :this => "hello", :that => "world")
- assert_equal %w(that this), extras.map(&:to_s).sort
+ assert_equal %w(that this), extras.map { |e| e.to_s }.sort
end
def test_draw
diff --git a/actionpack/test/dispatch/mime_type_test.rb b/actionpack/test/dispatch/mime_type_test.rb
index 2fdf4819bb..27bdd10ee5 100644
--- a/actionpack/test/dispatch/mime_type_test.rb
+++ b/actionpack/test/dispatch/mime_type_test.rb
@@ -56,7 +56,7 @@ class MimeTypeTest < ActiveSupport::TestCase
test "type convenience methods" do
# Don't test Mime::ALL, since it Mime::ALL#html? == true
- types = Mime::SET.to_a.map(&:to_sym).uniq - [:all]
+ types = Mime::SET.to_a.map{|m| m.to_sym }.uniq - [:all]
# Remove custom Mime::Type instances set in other tests, like Mime::GIF and Mime::IPHONE
types.delete_if { |type| !Mime.const_defined?(type.to_s.upcase) }
@@ -76,7 +76,7 @@ class MimeTypeTest < ActiveSupport::TestCase
end
test "verifiable mime types" do
- all_types = Mime::SET.to_a.map(&:to_sym)
+ all_types = Mime::SET.to_a.map{|m| m.to_sym}
all_types.uniq!
# Remove custom Mime::Type instances set in other tests, like Mime::GIF and Mime::IPHONE
all_types.delete_if { |type| !Mime.const_defined?(type.to_s.upcase) }
diff --git a/actionpack/test/fixtures/test/_local_inspector.html.erb b/actionpack/test/fixtures/test/_local_inspector.html.erb
index c5a6e3e5bc..e6765c0882 100644
--- a/actionpack/test/fixtures/test/_local_inspector.html.erb
+++ b/actionpack/test/fixtures/test/_local_inspector.html.erb
@@ -1 +1 @@
-<%= local_assigns.keys.map(&:to_s).sort.join(",") -%> \ No newline at end of file
+<%= local_assigns.keys.map {|k| k.to_s }.sort.join(",") -%> \ No newline at end of file
diff --git a/actionpack/test/new_base/abstract_unit.rb b/actionpack/test/new_base/abstract_unit.rb
index e6690d41d9..7d72f8393b 100644
--- a/actionpack/test/new_base/abstract_unit.rb
+++ b/actionpack/test/new_base/abstract_unit.rb
@@ -11,9 +11,6 @@ $stderr.puts "Running old tests on new_base"
require 'test/unit'
require 'active_support'
-# TODO : Revisit requiring all the core extensions here
-require 'active_support/core_ext'
-
require 'active_support/test_case'
require 'action_controller/abstract'
require 'action_controller/new_base'
@@ -45,6 +42,16 @@ ORIGINAL_LOCALES = I18n.available_locales.map {|locale| locale.to_s }.sort
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), '../fixtures')
+module ActionView
+ class TestCase
+ setup do
+ ActionController::Routing::Routes.draw do |map|
+ map.connect ':controller/:action/:id'
+ end
+ end
+ end
+end
+
module ActionController
Base.session = {
:key => '_testing_session',
diff --git a/actionpack/test/template/erb_util_test.rb b/actionpack/test/template/erb_util_test.rb
index c8c986f218..49f51c50c5 100644
--- a/actionpack/test/template/erb_util_test.rb
+++ b/actionpack/test/template/erb_util_test.rb
@@ -16,7 +16,7 @@ class ErbUtilTest < Test::Unit::TestCase
end
def test_rest_in_ascii
- (0..127).to_a.map(&:chr).each do |chr|
+ (0..127).to_a.map {|int| int.chr }.each do |chr|
next if %w(& " < >).include?(chr)
assert_equal chr, html_escape(chr)
end
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 104649deac..947668ccc6 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -99,6 +99,11 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal('<label for="my_for">Title</label>', label(:post, :title, nil, "for" => "my_for"))
end
+ def test_label_for_radio_buttons_with_value
+ assert_dom_equal('<label for="post_title_great_title">The title goes here</label>', label("post", "title", "The title goes here", :value => "great_title"))
+ assert_dom_equal('<label for="post_title_great_title">The title goes here</label>', label("post", "title", "The title goes here", :value => "great title"))
+ end
+
def test_text_field
assert_dom_equal(
'<input id="post_title" name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title")
@@ -532,6 +537,20 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal expected, output_buffer
end
+ def test_nested_fields_for_with_index_radio_button
+ form_for(:post, @post) do |f|
+ f.fields_for(:comment, @post, :index => 5) do |c|
+ concat c.radio_button(:title, "hello")
+ end
+ end
+
+ expected = "<form action='http://www.example.com' method='post'>" +
+ "<input name='post[comment][5][title]' type='radio' id='post_comment_5_title_hello' value='hello' />" +
+ "</form>"
+
+ assert_dom_equal expected, output_buffer
+ end
+
def test_nested_fields_for_with_auto_index_on_both
form_for("post[]", @post) do |f|
f.fields_for("comment[]", @post) do |c|
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb
index 5ca4d4d6ea..09d199b75d 100644
--- a/actionpack/test/template/form_tag_helper_test.rb
+++ b/actionpack/test/template/form_tag_helper_test.rb
@@ -154,6 +154,11 @@ class FormTagHelperTest < ActionView::TestCase
assert_dom_equal expected, actual
end
+ def test_text_area_tag_id_sanitized
+ input_elem = root_elem(text_area_tag("item[][description]"))
+ assert_match VALID_HTML_ID, input_elem['id']
+ end
+
def test_text_field_tag
actual = text_field_tag "title", "Hello!"
expected = %(<input id="title" name="title" type="text" value="Hello!" />)
diff --git a/actionpack/test/template/number_helper_test.rb b/actionpack/test/template/number_helper_test.rb
index b6542ef29d..57b740032e 100644
--- a/actionpack/test/template/number_helper_test.rb
+++ b/actionpack/test/template/number_helper_test.rb
@@ -3,6 +3,22 @@ require 'abstract_unit'
class NumberHelperTest < ActionView::TestCase
tests ActionView::Helpers::NumberHelper
+ def kilobytes(number)
+ number * 1024
+ end
+
+ def megabytes(number)
+ kilobytes(number) * 1024
+ end
+
+ def gigabytes(number)
+ megabytes(number) * 1024
+ end
+
+ def terabytes(number)
+ gigabytes(number) * 1024
+ end
+
def test_number_to_phone
assert_equal("555-1234", number_to_phone(5551234))
assert_equal("800-555-1212", number_to_phone(8005551212))
@@ -96,16 +112,16 @@ class NumberHelperTest < ActionView::TestCase
assert_equal '1.2 MB', number_to_human_size(1234567)
assert_equal '1.1 GB', number_to_human_size(1234567890)
assert_equal '1.1 TB', number_to_human_size(1234567890123)
- assert_equal '1025 TB', number_to_human_size(1025.terabytes)
- assert_equal '444 KB', number_to_human_size(444.kilobytes)
- assert_equal '1023 MB', number_to_human_size(1023.megabytes)
- assert_equal '3 TB', number_to_human_size(3.terabytes)
+ assert_equal '1025 TB', number_to_human_size(terabytes(1025))
+ assert_equal '444 KB', number_to_human_size(kilobytes(444))
+ assert_equal '1023 MB', number_to_human_size(megabytes(1023))
+ assert_equal '3 TB', number_to_human_size(terabytes(3))
assert_equal '1.18 MB', number_to_human_size(1234567, :precision => 2)
assert_equal '3 Bytes', number_to_human_size(3.14159265, :precision => 4)
assert_equal("123 Bytes", number_to_human_size("123"))
- assert_equal '1.01 KB', number_to_human_size(1.0123.kilobytes, :precision => 2)
- assert_equal '1.01 KB', number_to_human_size(1.0100.kilobytes, :precision => 4)
- assert_equal '10 KB', number_to_human_size(10.000.kilobytes, :precision => 4)
+ assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0123), :precision => 2)
+ assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0100), :precision => 4)
+ assert_equal '10 KB', number_to_human_size(kilobytes(10.000), :precision => 4)
assert_equal '1 Byte', number_to_human_size(1.1)
assert_equal '10 Bytes', number_to_human_size(10)
#assert_nil number_to_human_size('x') # fails due to API consolidation
@@ -115,9 +131,9 @@ class NumberHelperTest < ActionView::TestCase
def test_number_to_human_size_with_options_hash
assert_equal '1.18 MB', number_to_human_size(1234567, :precision => 2)
assert_equal '3 Bytes', number_to_human_size(3.14159265, :precision => 4)
- assert_equal '1.01 KB', number_to_human_size(1.0123.kilobytes, :precision => 2)
- assert_equal '1.01 KB', number_to_human_size(1.0100.kilobytes, :precision => 4)
- assert_equal '10 KB', number_to_human_size(10.000.kilobytes, :precision => 4)
+ assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0123), :precision => 2)
+ assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0100), :precision => 4)
+ assert_equal '10 KB', number_to_human_size(kilobytes(10.000), :precision => 4)
assert_equal '1 TB', number_to_human_size(1234567890123, :precision => 0)
assert_equal '500 MB', number_to_human_size(524288000, :precision=>0)
assert_equal '40 KB', number_to_human_size(41010, :precision => 0)
@@ -125,8 +141,8 @@ class NumberHelperTest < ActionView::TestCase
end
def test_number_to_human_size_with_custom_delimiter_and_separator
- assert_equal '1,01 KB', number_to_human_size(1.0123.kilobytes, :precision => 2, :separator => ',')
- assert_equal '1,01 KB', number_to_human_size(1.0100.kilobytes, :precision => 4, :separator => ',')
- assert_equal '1.000,1 TB', number_to_human_size(1000.1.terabytes, :delimiter => '.', :separator => ',')
+ assert_equal '1,01 KB', number_to_human_size(kilobytes(1.0123), :precision => 2, :separator => ',')
+ assert_equal '1,01 KB', number_to_human_size(kilobytes(1.0100), :precision => 4, :separator => ',')
+ assert_equal '1.000,1 TB', number_to_human_size(terabytes(1000.1), :delimiter => '.', :separator => ',')
end
end
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 20cd4cc1d4..2ed11aa3c0 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -13,7 +13,7 @@ module RenderTestCases
I18n.backend.store_translations 'pt-BR', {}
# Ensure original are still the same since we are reindexing view paths
- assert_equal ORIGINAL_LOCALES, I18n.available_locales.map(&:to_s).sort
+ assert_equal ORIGINAL_LOCALES, I18n.available_locales.map {|l| l.to_s }.sort
end
def test_render_file
diff --git a/activemodel/lib/active_model.rb b/activemodel/lib/active_model.rb
index 803f5b0157..a3545f1d53 100644
--- a/activemodel/lib/active_model.rb
+++ b/activemodel/lib/active_model.rb
@@ -21,12 +21,10 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-activesupport_path = "#{File.dirname(__FILE__)}/../../../activesupport/lib"
+activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
require 'active_support'
-require 'active_support/inflector'
-
module ActiveModel
autoload :Base, 'active_model/base'
autoload :Observing, 'active_model/observing'
diff --git a/activemodel/lib/active_model/deprecated_error_methods.rb b/activemodel/lib/active_model/deprecated_error_methods.rb
index 433de8931a..dd8050c549 100644
--- a/activemodel/lib/active_model/deprecated_error_methods.rb
+++ b/activemodel/lib/active_model/deprecated_error_methods.rb
@@ -19,7 +19,7 @@ module ActiveModel
ActiveSupport::Deprecation.warn "Errors#add_to_base(msg) has been deprecated, use Errors#[:base] << msg instead"
self[:base] << msg
end
-
+
def invalid?(attribute)
ActiveSupport::Deprecation.warn "Errors#invalid?(attribute) has been deprecated, use Errors#[attribute].any? instead"
self[attribute].any?
@@ -30,4 +30,4 @@ module ActiveModel
to_a.each { |error| yield error }
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 4be91d0505..2e643f108f 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/string/inflections'
+
module ActiveModel
class Errors < Hash
include DeprecatedErrorMethods
@@ -23,7 +25,7 @@ module ActiveModel
end
def each
- each_key do |attribute|
+ each_key do |attribute|
self[attribute].each { |error| yield attribute, error }
end
end
@@ -94,6 +96,7 @@ module ActiveModel
full_messages = []
each do |attribute, messages|
+ messages = Array.wrap(messages)
next if messages.empty?
if attribute == :base
@@ -111,15 +114,15 @@ module ActiveModel
end
# Translates an error message in it's default scope (<tt>activemodel.errrors.messages</tt>).
- # Error messages are first looked up in <tt>models.MODEL.attributes.ATTRIBUTE.MESSAGE</tt>, if it's not there,
- # it's looked up in <tt>models.MODEL.MESSAGE</tt> and if that is not there it returns the translation of the
- # default message (e.g. <tt>activemodel.errors.messages.MESSAGE</tt>). The translated model name,
+ # Error messages are first looked up in <tt>models.MODEL.attributes.ATTRIBUTE.MESSAGE</tt>, if it's not there,
+ # it's looked up in <tt>models.MODEL.MESSAGE</tt> and if that is not there it returns the translation of the
+ # default message (e.g. <tt>activemodel.errors.messages.MESSAGE</tt>). The translated model name,
# translated attribute name and the value are available for interpolation.
#
# When using inheritence in your models, it will check all the inherited models too, but only if the model itself
# hasn't been found. Say you have <tt>class Admin < User; end</tt> and you wanted the translation for the <tt>:blank</tt>
# error +message+ for the <tt>title</tt> +attribute+, it looks for these translations:
- #
+ #
# <ol>
# <li><tt>activemodel.errors.models.admin.attributes.title.blank</tt></li>
# <li><tt>activemodel.errors.models.admin.blank</tt></li>
@@ -135,7 +138,7 @@ module ActiveModel
klass_ancestors += @base.class.ancestors.reject {|x| x.is_a?(Module)}
defaults = klass_ancestors.map do |klass|
- [ :"models.#{klass.name.underscore}.attributes.#{attribute}.#{message}",
+ [ :"models.#{klass.name.underscore}.attributes.#{attribute}.#{message}",
:"models.#{klass.name.underscore}.#{message}" ]
end
@@ -155,4 +158,4 @@ module ActiveModel
I18n.translate(key, options)
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb
index 336c2757fc..6b6f51d942 100644
--- a/activemodel/lib/active_model/validations.rb
+++ b/activemodel/lib/active_model/validations.rb
@@ -1,3 +1,6 @@
+require 'active_support/core_ext/array/extract_options'
+require 'active_support/core_ext/hash/keys'
+
module ActiveModel
module Validations
extend ActiveSupport::Concern
@@ -69,10 +72,9 @@ module ActiveModel
end
private
-
- def validation_method(on)
- :validate
- end
+ def validation_method(on)
+ :validate
+ end
end
# Returns the Errors object that holds all information about attribute error messages.
diff --git a/activemodel/lib/active_model/validations/acceptance.rb b/activemodel/lib/active_model/validations/acceptance.rb
index 0c9ef51726..b65c9b933d 100644
--- a/activemodel/lib/active_model/validations/acceptance.rb
+++ b/activemodel/lib/active_model/validations/acceptance.rb
@@ -39,10 +39,10 @@ module ActiveModel
validates_each(attr_names,configuration) do |record, attr_name, value|
unless value == configuration[:accept]
- record.errors.add(attr_name, :accepted, :default => configuration[:message])
+ record.errors.add(attr_name, :accepted, :default => configuration[:message])
end
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb
index b9823172f7..d414224dd2 100644
--- a/activemodel/lib/active_model/validations/confirmation.rb
+++ b/activemodel/lib/active_model/validations/confirmation.rb
@@ -36,10 +36,10 @@ module ActiveModel
validates_each(attr_names, configuration) do |record, attr_name, value|
unless record.send("#{attr_name}_confirmation").nil? or value == record.send("#{attr_name}_confirmation")
- record.errors.add(attr_name, :confirmation, :default => configuration[:message])
+ record.errors.add(attr_name, :confirmation, :default => configuration[:message])
end
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb
index 0aa9848ee1..2cfdec97a5 100644
--- a/activemodel/lib/active_model/validations/exclusion.rb
+++ b/activemodel/lib/active_model/validations/exclusion.rb
@@ -29,10 +29,10 @@ module ActiveModel
validates_each(attr_names, configuration) do |record, attr_name, value|
if enum.include?(value)
- record.errors.add(attr_name, :exclusion, :default => configuration[:message], :value => value)
+ record.errors.add(attr_name, :exclusion, :default => configuration[:message], :value => value)
end
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations/format.rb b/activemodel/lib/active_model/validations/format.rb
index 8efce8ba2b..6f3b668bf0 100644
--- a/activemodel/lib/active_model/validations/format.rb
+++ b/activemodel/lib/active_model/validations/format.rb
@@ -32,10 +32,10 @@ module ActiveModel
validates_each(attr_names, configuration) do |record, attr_name, value|
unless value.to_s =~ configuration[:with]
- record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)
+ record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)
end
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb
index a4bc8fe035..0d7dc5cd64 100644
--- a/activemodel/lib/active_model/validations/inclusion.rb
+++ b/activemodel/lib/active_model/validations/inclusion.rb
@@ -29,10 +29,10 @@ module ActiveModel
validates_each(attr_names, configuration) do |record, attr_name, value|
unless enum.include?(value)
- record.errors.add(attr_name, :inclusion, :default => configuration[:message], :value => value)
+ record.errors.add(attr_name, :inclusion, :default => configuration[:message], :value => value)
end
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb
index bb9a269a02..db0439d447 100644
--- a/activemodel/lib/active_model/validations/length.rb
+++ b/activemodel/lib/active_model/validations/length.rb
@@ -81,7 +81,7 @@ module ActiveModel
validates_each(attrs, options) do |record, attr, value|
value = options[:tokenizer].call(value) if value.kind_of?(String)
unless !value.nil? and value.size.method(validity_checks[option])[option_value]
- record.errors.add(attr, key, :default => custom_message, :count => option_value)
+ record.errors.add(attr, key, :default => custom_message, :count => option_value)
end
end
end
@@ -90,4 +90,4 @@ module ActiveModel
alias_method :validates_size_of, :validates_length_of
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb
index 79fca2f1ea..ada6e28594 100644
--- a/activemodel/lib/active_model/validations/numericality.rb
+++ b/activemodel/lib/active_model/validations/numericality.rb
@@ -71,7 +71,7 @@ module ActiveModel
case option
when :odd, :even
unless raw_value.to_i.method(ALL_NUMERICALITY_CHECKS[option])[]
- record.errors.add(attr_name, option, :value => raw_value, :default => configuration[:message])
+ record.errors.add(attr_name, option, :value => raw_value, :default => configuration[:message])
end
else
unless raw_value.method(ALL_NUMERICALITY_CHECKS[option])[configuration[option]]
@@ -83,4 +83,4 @@ module ActiveModel
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb
index 518bc8a952..72d6b1c6f0 100644
--- a/activemodel/lib/active_model/validations/presence.rb
+++ b/activemodel/lib/active_model/validations/presence.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/object/blank'
+
module ActiveModel
module Validations
module ClassMethods
@@ -16,7 +18,7 @@ module ActiveModel
#
# Configuration options:
# * <tt>message</tt> - A custom error message (default is: "can't be blank").
- # * <tt>on</tt> - Specifies when this validation is active (default is <tt>:save</tt>, other options <tt>:create</tt>,
+ # * <tt>on</tt> - Specifies when this validation is active (default is <tt>:save</tt>, other options <tt>:create</tt>,
# <tt>:update</tt>).
# * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should
# occur (e.g. <tt>:if => :allow_validation</tt>, or <tt>:if => Proc.new { |user| user.signup_step > 2 }</tt>).
@@ -36,4 +38,4 @@ module ActiveModel
end
end
end
-end \ No newline at end of file
+end
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 763db3900d..90a90a0a9b 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -288,7 +288,13 @@ module ActiveRecord
# Escapes binary strings for bytea input to the database.
def escape_bytea(value)
- if PGconn.respond_to?(:escape_bytea)
+ if @connection.respond_to?(:escape_bytea)
+ self.class.instance_eval do
+ define_method(:escape_bytea) do |value|
+ @connection.escape_bytea(value) if value
+ end
+ end
+ elsif PGconn.respond_to?(:escape_bytea)
self.class.instance_eval do
define_method(:escape_bytea) do |value|
PGconn.escape_bytea(value) if value
@@ -377,7 +383,13 @@ module ActiveRecord
# Quotes strings for use in SQL input in the postgres driver for better performance.
def quote_string(s) #:nodoc:
- if PGconn.respond_to?(:escape)
+ if @connection.respond_to?(:escape)
+ self.class.instance_eval do
+ define_method(:quote_string) do |s|
+ @connection.escape(s)
+ end
+ end
+ elsif PGconn.respond_to?(:escape)
self.class.instance_eval do
define_method(:quote_string) do |s|
PGconn.escape(s)
diff --git a/activerecord/lib/active_record/serialization.rb b/activerecord/lib/active_record/serialization.rb
index 7959f2b510..23d085bea9 100644
--- a/activerecord/lib/active_record/serialization.rb
+++ b/activerecord/lib/active_record/serialization.rb
@@ -3,8 +3,9 @@ module ActiveRecord #:nodoc:
class Serializer #:nodoc:
attr_reader :options
- def initialize(record, options = {})
- @record, @options = record, options.dup
+ def initialize(record, options = nil)
+ @record = record
+ @options = options ? options.dup : {}
end
# To replicate the behavior in ActiveRecord#attributes,
diff --git a/activerecord/lib/active_record/serializers/json_serializer.rb b/activerecord/lib/active_record/serializers/json_serializer.rb
index 67e2b2abb3..e49cf59494 100644
--- a/activerecord/lib/active_record/serializers/json_serializer.rb
+++ b/activerecord/lib/active_record/serializers/json_serializer.rb
@@ -1,4 +1,5 @@
require 'active_support/json'
+require 'active_support/core_ext/module/model_naming'
module ActiveRecord #:nodoc:
module Serialization
@@ -74,36 +75,17 @@ module ActiveRecord #:nodoc:
# "title": "Welcome to the weblog"},
# {"comments": [{"body": "Don't think too hard"}],
# "title": "So I was thinking"}]}
- def to_json(options = {})
- json = JsonSerializer.new(self, options).to_s
- if include_root_in_json
- "{#{self.class.json_class_name}:#{json}}"
- else
- json
- end
+ def encode_json(encoder)
+ hash = Serializer.new(self, encoder.options).serializable_record
+ hash = { self.class.model_name.element => hash } if include_root_in_json
+ ActiveSupport::JSON.encode(hash)
end
+ def as_json(options = nil) self end #:nodoc:
+
def from_json(json)
self.attributes = ActiveSupport::JSON.decode(json)
self
end
-
- private
- # For compatibility with ActiveSupport::JSON.encode
- def rails_to_json(options, *args)
- to_json(options)
- end
-
- class JsonSerializer < ActiveRecord::Serialization::Serializer #:nodoc:
- def serialize
- ActiveSupport::JSON.encode(serializable_record)
- end
- end
-
- module ClassMethods
- def json_class_name
- @json_class_name ||= name.demodulize.underscore.inspect
- end
- end
end
end
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index 85b65ecf1a..a150ba4acf 100644
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -40,6 +40,7 @@ module ActiveRecord
full_messages = []
each do |attribute, messages|
+ messages = Array.wrap(messages)
next if messages.empty?
if attribute == :base
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 59aa6953e3..96270118d8 100755
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -146,7 +146,12 @@ class BasicsTest < ActiveRecord::TestCase
def test_read_attributes_before_type_cast_on_datetime
developer = Developer.find(:first)
- assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"]
+ # Oracle adapter returns Time before type cast
+ unless current_adapter?(:OracleAdapter)
+ assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"]
+ else
+ assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"].to_s(:db)
+ end
end
def test_hash_content
@@ -682,21 +687,24 @@ class BasicsTest < ActiveRecord::TestCase
end
end
- def test_update_all_ignores_order_without_limit_from_association
- author = authors(:david)
- assert_nothing_raised do
- assert_equal author.posts_with_comments_and_categories.length, author.posts_with_comments_and_categories.update_all([ "body = ?", "bulk update!" ])
+ # Oracle UPDATE does not support ORDER BY
+ unless current_adapter?(:OracleAdapter)
+ def test_update_all_ignores_order_without_limit_from_association
+ author = authors(:david)
+ assert_nothing_raised do
+ assert_equal author.posts_with_comments_and_categories.length, author.posts_with_comments_and_categories.update_all([ "body = ?", "bulk update!" ])
+ end
end
- end
- def test_update_all_with_order_and_limit_updates_subset_only
- author = authors(:david)
- assert_nothing_raised do
- assert_equal 1, author.posts_sorted_by_id_limited.size
- assert_equal 2, author.posts_sorted_by_id_limited.find(:all, :limit => 2).size
- assert_equal 1, author.posts_sorted_by_id_limited.update_all([ "body = ?", "bulk update!" ])
- assert_equal "bulk update!", posts(:welcome).body
- assert_not_equal "bulk update!", posts(:thinking).body
+ def test_update_all_with_order_and_limit_updates_subset_only
+ author = authors(:david)
+ assert_nothing_raised do
+ assert_equal 1, author.posts_sorted_by_id_limited.size
+ assert_equal 2, author.posts_sorted_by_id_limited.find(:all, :limit => 2).size
+ assert_equal 1, author.posts_sorted_by_id_limited.update_all([ "body = ?", "bulk update!" ])
+ assert_equal "bulk update!", posts(:welcome).body
+ assert_not_equal "bulk update!", posts(:thinking).body
+ end
end
end
@@ -1117,22 +1125,25 @@ class BasicsTest < ActiveRecord::TestCase
Topic.skip_time_zone_conversion_for_attributes = []
end
- def test_multiparameter_attributes_on_time_only_column_with_time_zone_aware_attributes_does_not_do_time_zone_conversion
- ActiveRecord::Base.time_zone_aware_attributes = true
- ActiveRecord::Base.default_timezone = :utc
- Time.zone = ActiveSupport::TimeZone[-28800]
- attributes = {
- "bonus_time(1i)" => "2000", "bonus_time(2i)" => "1", "bonus_time(3i)" => "1",
- "bonus_time(4i)" => "16", "bonus_time(5i)" => "24"
- }
- topic = Topic.find(1)
- topic.attributes = attributes
- assert_equal Time.utc(2000, 1, 1, 16, 24, 0), topic.bonus_time
- assert topic.bonus_time.utc?
- ensure
- ActiveRecord::Base.time_zone_aware_attributes = false
- ActiveRecord::Base.default_timezone = :local
- Time.zone = nil
+ # Oracle, and Sybase do not have a TIME datatype.
+ unless current_adapter?(:OracleAdapter, :SybaseAdapter)
+ def test_multiparameter_attributes_on_time_only_column_with_time_zone_aware_attributes_does_not_do_time_zone_conversion
+ ActiveRecord::Base.time_zone_aware_attributes = true
+ ActiveRecord::Base.default_timezone = :utc
+ Time.zone = ActiveSupport::TimeZone[-28800]
+ attributes = {
+ "bonus_time(1i)" => "2000", "bonus_time(2i)" => "1", "bonus_time(3i)" => "1",
+ "bonus_time(4i)" => "16", "bonus_time(5i)" => "24"
+ }
+ topic = Topic.find(1)
+ topic.attributes = attributes
+ assert_equal Time.utc(2000, 1, 1, 16, 24, 0), topic.bonus_time
+ assert topic.bonus_time.utc?
+ ensure
+ ActiveRecord::Base.time_zone_aware_attributes = false
+ ActiveRecord::Base.default_timezone = :local
+ Time.zone = nil
+ end
end
def test_multiparameter_attributes_on_time_with_empty_seconds
diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb
index 0ffbc9bf3b..54bc8e2343 100644
--- a/activerecord/test/cases/json_serialization_test.rb
+++ b/activerecord/test/cases/json_serialization_test.rb
@@ -170,18 +170,18 @@ class DatabaseConnectedJsonEncodingTest < ActiveRecord::TestCase
def test_should_allow_only_option_for_list_of_authors
authors = [@david, @mary]
- assert_equal %([{"name":"David"},{"name":"Mary"}]), authors.to_json(:only => :name)
+ assert_equal %([{"name":"David"},{"name":"Mary"}]), ActiveSupport::JSON.encode(authors, :only => :name)
end
def test_should_allow_except_option_for_list_of_authors
authors = [@david, @mary]
- assert_equal %([{"id":1},{"id":2}]), authors.to_json(:except => [:name, :author_address_id, :author_address_extra_id])
+ assert_equal %([{"id":1},{"id":2}]), ActiveSupport::JSON.encode(authors, :except => [:name, :author_address_id, :author_address_extra_id])
end
def test_should_allow_includes_for_list_of_authors
authors = [@david, @mary]
- json = authors.to_json(
+ json = ActiveSupport::JSON.encode(authors,
:only => :name,
:include => {
:posts => { :only => :id }
@@ -200,6 +200,6 @@ class DatabaseConnectedJsonEncodingTest < ActiveRecord::TestCase
2 => @mary
}
- assert_equal %({"1":{"name":"David"}}), authors_hash.to_json(:only => [1, :name])
+ assert_equal %({"1":{"name":"David"}}), ActiveSupport::JSON.encode(authors_hash, :only => [1, :name])
end
end
diff --git a/activerecord/test/schema/oracle_specific_schema.rb b/activerecord/test/schema/oracle_specific_schema.rb
new file mode 100644
index 0000000000..2d87f34625
--- /dev/null
+++ b/activerecord/test/schema/oracle_specific_schema.rb
@@ -0,0 +1,19 @@
+ActiveRecord::Schema.define do
+
+ execute "drop table test_oracle_defaults" rescue nil
+ execute "drop sequence test_oracle_defaults_seq" rescue nil
+
+ execute <<-SQL
+create table test_oracle_defaults (
+ id integer not null primary key,
+ test_char char(1) default 'X' not null,
+ test_string varchar2(20) default 'hello' not null,
+ test_int integer default 3 not null
+)
+ SQL
+
+ execute <<-SQL
+create sequence test_oracle_defaults_seq minvalue 10000
+ SQL
+
+end
diff --git a/activeresource/examples/simple.rb b/activeresource/examples/simple.rb
index b20ef61670..6d2c6e3b1b 100644
--- a/activeresource/examples/simple.rb
+++ b/activeresource/examples/simple.rb
@@ -1,6 +1,5 @@
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
-require 'active_resource/http_mock'
require 'active_support/core_ext/hash/conversions'
ActiveSupport::XmlMini.backend = ENV['XMLMINI'] || 'REXML'
diff --git a/activeresource/lib/active_resource.rb b/activeresource/lib/active_resource.rb
index b46801affc..1dcb795a7d 100644
--- a/activeresource/lib/active_resource.rb
+++ b/activeresource/lib/active_resource.rb
@@ -25,18 +25,15 @@ activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
require 'active_support'
-begin
- require 'active_model'
-rescue LoadError
- $:.unshift "#{File.dirname(__FILE__)}/../../activemodel/lib"
- require 'active_model'
-end
-
-require 'active_resource/formats'
-require 'active_resource/base'
-require 'active_resource/validations'
-require 'active_resource/custom_methods'
+activemodel_path = "#{File.dirname(__FILE__)}/../../activemodel/lib"
+$:.unshift(activemodel_path) if File.directory?(activemodel_path)
+require 'active_model'
module ActiveResource
autoload :Base, 'active_resource/base'
+ autoload :Connection, 'active_resource/connection'
+ autoload :CustomMethods, 'active_resource/custom_methods'
+ autoload :Formats, 'active_resource/formats'
+ autoload :Validations, 'active_resource/validations'
+ autoload :HttpMock, 'active_resource/http_mock'
end
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 11a7bbba3e..a4f2a7e16a 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -10,10 +10,9 @@ require 'active_support/core_ext/object/misc'
require 'set'
require 'uri'
-module ActiveResource
- autoload :Formats, 'active_resource/formats'
- autoload :Connection, 'active_resource/connection'
+require 'active_resource/exceptions'
+module ActiveResource
# ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application.
#
# For an outline of what Active Resource is capable of, see link:files/vendor/rails/activeresource/README.html.
@@ -873,7 +872,7 @@ module ActiveResource
attributes.to_xml({:root => self.class.element_name}.merge(options))
end
- # Converts the resource to a JSON string representation.
+ # Coerces to a hash for JSON encoding.
#
# ==== Options
# The +options+ are passed to the +to_json+ method on each
@@ -897,8 +896,8 @@ module ActiveResource
#
# person.to_json(:except => ["first_name"])
# # => {"last_name": "Smith"}
- def to_json(options={})
- ActiveSupport::JSON.encode(attributes, options)
+ def as_json(options = nil)
+ attributes.as_json(options)
end
# Returns the serialized string representation of the resource in the configured
@@ -1072,11 +1071,6 @@ module ActiveResource
self.class.__send__(:split_options, options)
end
- # For compatibility with ActiveSupport::JSON.encode
- def rails_to_json(options, *args)
- to_json(options)
- end
-
def method_missing(method_symbol, *arguments) #:nodoc:
method_name = method_symbol.to_s
@@ -1090,7 +1084,8 @@ module ActiveResource
end
end
end
-end
-require 'active_resource/validations'
-require 'active_resource/custom_methods'
+ class Base
+ include CustomMethods, Validations
+ end
+end
diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb
index 6661469c5b..fb3fde59d6 100644
--- a/activeresource/lib/active_resource/connection.rb
+++ b/activeresource/lib/active_resource/connection.rb
@@ -1,5 +1,3 @@
-require 'active_resource/exceptions'
-require 'active_resource/formats'
require 'active_support/core_ext/benchmark'
require 'net/https'
require 'date'
diff --git a/activeresource/lib/active_resource/custom_methods.rb b/activeresource/lib/active_resource/custom_methods.rb
index 0d05d06035..ff14b49b07 100644
--- a/activeresource/lib/active_resource/custom_methods.rb
+++ b/activeresource/lib/active_resource/custom_methods.rb
@@ -31,47 +31,44 @@ module ActiveResource
# # => [{:id => 1, :name => 'Ryan'}, {:id => 2, :name => 'Joe'}]
#
module CustomMethods
- def self.included(base)
- base.class_eval do
- extend ActiveResource::CustomMethods::ClassMethods
- include ActiveResource::CustomMethods::InstanceMethods
+ extend ActiveSupport::Concern
- class << self
- alias :orig_delete :delete
+ included do
+ class << self
+ alias :orig_delete :delete
- # Invokes a GET to a given custom REST method. For example:
- #
- # Person.get(:active) # GET /people/active.xml
- # # => [{:id => 1, :name => 'Ryan'}, {:id => 2, :name => 'Joe'}]
- #
- # Person.get(:active, :awesome => true) # GET /people/active.xml?awesome=true
- # # => [{:id => 1, :name => 'Ryan'}]
- #
- # Note: the objects returned from this method are not automatically converted
- # into ActiveResource::Base instances - they are ordinary Hashes. If you are expecting
- # ActiveResource::Base instances, use the <tt>find</tt> class method with the
- # <tt>:from</tt> option. For example:
- #
- # Person.find(:all, :from => :active)
- def get(custom_method_name, options = {})
- connection.get(custom_method_collection_url(custom_method_name, options), headers)
- end
+ # Invokes a GET to a given custom REST method. For example:
+ #
+ # Person.get(:active) # GET /people/active.xml
+ # # => [{:id => 1, :name => 'Ryan'}, {:id => 2, :name => 'Joe'}]
+ #
+ # Person.get(:active, :awesome => true) # GET /people/active.xml?awesome=true
+ # # => [{:id => 1, :name => 'Ryan'}]
+ #
+ # Note: the objects returned from this method are not automatically converted
+ # into ActiveResource::Base instances - they are ordinary Hashes. If you are expecting
+ # ActiveResource::Base instances, use the <tt>find</tt> class method with the
+ # <tt>:from</tt> option. For example:
+ #
+ # Person.find(:all, :from => :active)
+ def get(custom_method_name, options = {})
+ connection.get(custom_method_collection_url(custom_method_name, options), headers)
+ end
- def post(custom_method_name, options = {}, body = '')
- connection.post(custom_method_collection_url(custom_method_name, options), body, headers)
- end
+ def post(custom_method_name, options = {}, body = '')
+ connection.post(custom_method_collection_url(custom_method_name, options), body, headers)
+ end
- def put(custom_method_name, options = {}, body = '')
- connection.put(custom_method_collection_url(custom_method_name, options), body, headers)
- end
+ def put(custom_method_name, options = {}, body = '')
+ connection.put(custom_method_collection_url(custom_method_name, options), body, headers)
+ end
- def delete(custom_method_name, options = {})
- # Need to jump through some hoops to retain the original class 'delete' method
- if custom_method_name.is_a?(Symbol)
- connection.delete(custom_method_collection_url(custom_method_name, options), headers)
- else
- orig_delete(custom_method_name, options)
- end
+ def delete(custom_method_name, options = {})
+ # Need to jump through some hoops to retain the original class 'delete' method
+ if custom_method_name.is_a?(Symbol)
+ connection.delete(custom_method_collection_url(custom_method_name, options), headers)
+ else
+ orig_delete(custom_method_name, options)
end
end
end
@@ -117,8 +114,4 @@ module ActiveResource
end
end
end
-
- class Base
- include CustomMethods
- end
end
diff --git a/activeresource/lib/active_resource/formats/json_format.rb b/activeresource/lib/active_resource/formats/json_format.rb
index 101027d99e..9980634921 100644
--- a/activeresource/lib/active_resource/formats/json_format.rb
+++ b/activeresource/lib/active_resource/formats/json_format.rb
@@ -13,8 +13,8 @@ module ActiveResource
"application/json"
end
- def encode(hash, options={})
- hash.to_json(options)
+ def encode(hash, options = nil)
+ ActiveSupport::JSON.encode(hash, options)
end
def decode(json)
diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb
index aae2d6508c..e5891300a6 100644
--- a/activeresource/lib/active_resource/http_mock.rb
+++ b/activeresource/lib/active_resource/http_mock.rb
@@ -1,4 +1,3 @@
-require 'active_resource/connection'
require 'active_support/core_ext/kernel/reporting'
module ActiveResource
diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb
index 95c5467647..a2ba224998 100644
--- a/activeresource/lib/active_resource/validations.rb
+++ b/activeresource/lib/active_resource/validations.rb
@@ -1,4 +1,3 @@
-require 'active_resource/exceptions'
require 'active_support/core_ext/array/wrap'
module ActiveResource
@@ -46,10 +45,10 @@ module ActiveResource
# person.save # => true (and person is now saved to the remote service)
#
module Validations
- def self.included(base) # :nodoc:
- base.class_eval do
- alias_method_chain :save, :validation
- end
+ extend ActiveSupport::Concern
+
+ included do
+ alias_method_chain :save, :validation
end
# Validate a resource and save (POST) it to the remote web service.
@@ -80,8 +79,4 @@ module ActiveResource
@errors ||= Errors.new(self)
end
end
-
- class Base
- include Validations
- end
end
diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb
index 3398f2dac7..863c7bf709 100644
--- a/activeresource/test/abstract_unit.rb
+++ b/activeresource/test/abstract_unit.rb
@@ -6,7 +6,6 @@ require 'mocha'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
-require 'active_resource/http_mock'
$:.unshift "#{File.dirname(__FILE__)}/../test"
require 'setter_trap'
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 27d26b2ba5..9c5803c52a 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,11 @@
*Edge*
+* JSON: +Object#to_json+ calls +as_json+ to coerce itself into something natively encodable like +Hash+, +Integer+, or +String+. Override +as_json+ instead of +to_json+ so you're JSON library agnostic. [Jeremy Kemper]
+
+* String #to_time and #to_datetime: handle fractional seconds #864 [Jason Frey]
+
+* Update bundled TZInfo to v0.3.13 [Geoff Buesing]
+
* Allow MemCacheStore to be initialized with a MemCache-like object instead of addresses and options [Bryan Helmkamp]
* Change spelling of Kyev timezone to Kyiv #2613 [Alexander Dymo]
diff --git a/activesupport/Rakefile b/activesupport/Rakefile
index c3ea09d424..238594debb 100644
--- a/activesupport/Rakefile
+++ b/activesupport/Rakefile
@@ -101,6 +101,16 @@ namespace :tzinfo do
desc "Update bundled tzinfo gem. Only copies the subset of classes and definitions required to support Rails time zone features."
task :update => ['tzinfo:copy_classes', 'tzinfo:copy_definitions'] do
Rake::Task['tzinfo:cleanup_tmp'].invoke
+ puts <<-EOV
+ *** FINAL TZINFO BUNDLING STEPS ***
+
+ 1. Update TZInfo version in lib/active_support/vendor.rb
+ 2. gem uninstall tzinfo on local system before running tests, to ensure tests are running against bundled version
+
+ If a test fails because a particular zone can't be found, it's likely because the TZInfo identifier in the
+ ActiveSupport::TimeZone::MAPPING hash is referencing a linked timezone instead of referencing the timezone directly.
+ In this case, just change the MAPPING value to the correct identifier, and unpack TZInfo again.
+ EOV
end
task :unpack_gem do
diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
index cca93a0b9f..8bac2dff19 100644
--- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -202,6 +202,8 @@ class Class
def #{ivar}=(obj) self.class.#{ivar} = obj end
RUBY
end
+
+ self.send("#{ivar}=", yield) if block_given?
end
end
@@ -214,8 +216,8 @@ class Class
# @return <Array[#to_s]> An Array of attributes turned into inheritable accessors.
#
# @api public
- def extlib_inheritable_accessor(*syms)
+ def extlib_inheritable_accessor(*syms, &block)
extlib_inheritable_reader(*syms)
- extlib_inheritable_writer(*syms)
+ extlib_inheritable_writer(*syms, &block)
end
end
diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
index 4007a647be..0813a51383 100644
--- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
@@ -2,12 +2,14 @@ module Kernel
unless respond_to?(:debugger)
# Starts a debugging session if ruby-debug has been loaded (call script/server --debugger to do load it).
def debugger
- Rails.logger.info "\n***** Debugger requested, but was not available: Start server with --debugger to enable *****\n"
+ message = "\n***** Debugger requested, but was not available: Start server with --debugger to enable *****\n"
+ defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message)
end
end
def breakpoint
- Rails.logger.info "\n***** The 'breakpoint' command has been renamed 'debugger' -- please change *****\n"
+ message = "\n***** The 'breakpoint' command has been renamed 'debugger' -- please change *****\n"
+ defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message)
debugger
end
end
diff --git a/activesupport/lib/active_support/core_ext/module/model_naming.rb b/activesupport/lib/active_support/core_ext/module/model_naming.rb
index 36fde87b23..13420bab07 100644
--- a/activesupport/lib/active_support/core_ext/module/model_naming.rb
+++ b/activesupport/lib/active_support/core_ext/module/model_naming.rb
@@ -2,14 +2,16 @@ require 'active_support/inflector'
module ActiveSupport
class ModelName < String
- attr_reader :singular, :plural, :cache_key, :partial_path
+ attr_reader :singular, :plural, :element, :collection, :partial_path
+ alias_method :cache_key, :collection
def initialize(name)
super
@singular = ActiveSupport::Inflector.underscore(self).tr('/', '_').freeze
@plural = ActiveSupport::Inflector.pluralize(@singular).freeze
- @cache_key = tableize.freeze
- @partial_path = "#{@cache_key}/#{ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self))}".freeze
+ @element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)).freeze
+ @collection = ActiveSupport::Inflector.tableize(self).freeze
+ @partial_path = "#{@collection}/#{@element}".freeze
end
end
end
diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb
index 2b9f8c70f6..331416b3a9 100644
--- a/activesupport/lib/active_support/core_ext/string/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/string/conversions.rb
@@ -9,7 +9,9 @@ class String
# Form can be either :utc (default) or :local.
def to_time(form = :utc)
- ::Time.send("#{form}_time", *::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 })
+ d = ::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction).map { |arg| arg || 0 }
+ d[6] *= 1000000
+ ::Time.send("#{form}_time", *d)
end
def to_date
@@ -17,6 +19,8 @@ class String
end
def to_datetime
- ::DateTime.civil(*::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 })
+ d = ::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :sec_fraction).map { |arg| arg || 0 }
+ d[5] += d.pop
+ ::DateTime.civil(*d)
end
end
diff --git a/activesupport/lib/active_support/json.rb b/activesupport/lib/active_support/json.rb
index 6d845182fb..3e1d9b1d33 100644
--- a/activesupport/lib/active_support/json.rb
+++ b/activesupport/lib/active_support/json.rb
@@ -1,87 +1,2 @@
-require 'active_support/core_ext/module/delegation'
-require 'active_support/core_ext/module/attribute_accessors'
-
-module ActiveSupport
- # If true, use ISO 8601 format for dates and times. Otherwise, fall back to the Active Support legacy format.
- mattr_accessor :use_standard_json_time_format
- # Look for and parse json strings that look like ISO 8601 times.
- mattr_accessor :parse_json_times
-
- module JSON
- # matches YAML-formatted dates
- DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?))$/
-
- module Encoding #:nodoc:
- mattr_accessor :escape_regex
-
- ESCAPED_CHARS = {
- "\010" => '\b',
- "\f" => '\f',
- "\n" => '\n',
- "\r" => '\r',
- "\t" => '\t',
- '"' => '\"',
- '\\' => '\\\\',
- '>' => '\u003E',
- '<' => '\u003C',
- '&' => '\u0026'
- }
-
- def self.escape(string)
- string = string.dup.force_encoding(::Encoding::BINARY) if string.respond_to?(:force_encoding)
- json = string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] }.
- gsub(/([\xC0-\xDF][\x80-\xBF]|
- [\xE0-\xEF][\x80-\xBF]{2}|
- [\xF0-\xF7][\x80-\xBF]{3})+/nx) { |s|
- s.unpack("U*").pack("n*").unpack("H*")[0].gsub(/.{4}/, '\\\\u\&')
- }
- %("#{json}")
- end
- end
-
- class << self
- delegate :decode, :to => :backend
-
- def backend
- unless defined? @backend
- self.backend = defined?(::JSON) ? "JSONGem" : "Yaml"
- end
- @backend
- end
-
- def backend=(name)
- if name.is_a?(Module)
- @backend = name
- else
- require "active_support/json/backends/#{name.to_s.downcase}.rb"
- @backend = ActiveSupport::JSON::Backends::const_get(name)
- end
- end
-
- def with_backend(name)
- old_backend, self.backend = backend, name
- yield
- ensure
- self.backend = old_backend
- end
- end
- end
-
- class << self
- attr_reader :escape_html_entities_in_json
-
- def escape_html_entities_in_json=(value)
- ActiveSupport::JSON::Encoding.escape_regex = \
- if value
- /[\010\f\n\r\t"\\><&]/
- else
- /[\010\f\n\r\t"\\]/
- end
- @escape_html_entities_in_json = value
- end
- end
-end
-
-ActiveSupport.escape_html_entities_in_json = true
-
+require 'active_support/json/decoding'
require 'active_support/json/encoding'
diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb
new file mode 100644
index 0000000000..b4e4177724
--- /dev/null
+++ b/activesupport/lib/active_support/json/decoding.rb
@@ -0,0 +1,33 @@
+require 'active_support/core_ext/module/attribute_accessors'
+
+module ActiveSupport
+ # Look for and parse json strings that look like ISO 8601 times.
+ mattr_accessor :parse_json_times
+
+ module JSON
+ class << self
+ delegate :decode, :to => :backend
+
+ def backend
+ self.backend = "Yaml" unless defined?(@backend)
+ @backend
+ end
+
+ def backend=(name)
+ if name.is_a?(Module)
+ @backend = name
+ else
+ require "active_support/json/backends/#{name.to_s.downcase}.rb"
+ @backend = ActiveSupport::JSON::Backends::const_get(name)
+ end
+ end
+
+ def with_backend(name)
+ old_backend, self.backend = backend, name
+ yield
+ ensure
+ self.backend = old_backend
+ end
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/json/encoders/date.rb b/activesupport/lib/active_support/json/encoders/date.rb
deleted file mode 100644
index 9adb3c20e2..0000000000
--- a/activesupport/lib/active_support/json/encoders/date.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-class Date
- private
- # Returns a JSON string representing the date. If ActiveSupport.use_standard_json_time_format is set to true, the
- # ISO 8601 format is used.
- #
- # ==== Examples
- #
- # # With ActiveSupport.use_standard_json_time_format = true
- # Date.new(2005,2,1).to_json
- # # => "2005-02-01"
- #
- # # With ActiveSupport.use_standard_json_time_format = false
- # Date.new(2005,2,1).to_json
- # # => "2005/02/01"
- def rails_to_json(*)
- if ActiveSupport.use_standard_json_time_format
- %("#{strftime("%Y-%m-%d")}")
- else
- %("#{strftime("%Y/%m/%d")}")
- end
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/date_time.rb b/activesupport/lib/active_support/json/encoders/date_time.rb
deleted file mode 100644
index 3a29292b24..0000000000
--- a/activesupport/lib/active_support/json/encoders/date_time.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-class DateTime
- private
- # Returns a JSON string representing the datetime. If ActiveSupport.use_standard_json_time_format is set to true, the
- # ISO 8601 format is used.
- #
- # ==== Examples
- #
- # # With ActiveSupport.use_standard_json_time_format = true
- # DateTime.civil(2005,2,1,15,15,10).to_json
- # # => "2005-02-01T15:15:10+00:00"
- #
- # # With ActiveSupport.use_standard_json_time_format = false
- # DateTime.civil(2005,2,1,15,15,10).to_json
- # # => "2005/02/01 15:15:10 +0000"
- def rails_to_json(*)
- if ActiveSupport.use_standard_json_time_format
- xmlschema.inspect
- else
- strftime('"%Y/%m/%d %H:%M:%S %z"')
- end
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/enumerable.rb b/activesupport/lib/active_support/json/encoders/enumerable.rb
deleted file mode 100644
index 898990a59c..0000000000
--- a/activesupport/lib/active_support/json/encoders/enumerable.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Enumerable
- private
- # Returns a JSON string representing the enumerable. Any +options+
- # given will be passed on to its elements. For example:
- #
- # users = User.find(:all)
- # # => users.to_json(:only => :name)
- #
- # will pass the <tt>:only => :name</tt> option to each user.
- def rails_to_json(options = nil, *args) #:nodoc:
- "[#{map { |value| ActiveSupport::JSON.encode(value, options, *args) } * ','}]"
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/false_class.rb b/activesupport/lib/active_support/json/encoders/false_class.rb
deleted file mode 100644
index eb975fe542..0000000000
--- a/activesupport/lib/active_support/json/encoders/false_class.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class FalseClass
- private
- def rails_to_json(*)
- 'false'
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/hash.rb b/activesupport/lib/active_support/json/encoders/hash.rb
deleted file mode 100644
index 4771484843..0000000000
--- a/activesupport/lib/active_support/json/encoders/hash.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require 'active_support/core_ext/array/wrap'
-
-class Hash
- private
- # Returns a JSON string representing the hash.
- #
- # Without any +options+, the returned JSON string will include all
- # the hash keys. For example:
- #
- # { :name => "Konata Izumi", 'age' => 16, 1 => 2 }.to_json
- # # => {"name": "Konata Izumi", "1": 2, "age": 16}
- #
- # The keys in the JSON string are unordered due to the nature of hashes.
- #
- # The <tt>:only</tt> and <tt>:except</tt> options can be used to limit the
- # attributes included, and will accept 1 or more hash keys to include/exclude.
- #
- # { :name => "Konata Izumi", 'age' => 16, 1 => 2 }.to_json(:only => [:name, 'age'])
- # # => {"name": "Konata Izumi", "age": 16}
- #
- # { :name => "Konata Izumi", 'age' => 16, 1 => 2 }.to_json(:except => 1)
- # # => {"name": "Konata Izumi", "age": 16}
- #
- # The +options+ also filter down to any hash values. This is particularly
- # useful for converting hashes containing ActiveRecord objects or any object
- # that responds to options in their <tt>to_json</tt> method. For example:
- #
- # users = User.find(:all)
- # { :users => users, :count => users.size }.to_json(:include => :posts)
- #
- # would pass the <tt>:include => :posts</tt> option to <tt>users</tt>,
- # allowing the posts association in the User model to be converted to JSON
- # as well.
- def rails_to_json(options = nil, *args) #:nodoc:
- hash_keys = self.keys
-
- if options
- if except = options[:except]
- hash_keys = hash_keys - Array.wrap(except)
- elsif only = options[:only]
- hash_keys = hash_keys & Array.wrap(only)
- end
- end
-
- result = '{'
- result << hash_keys.map do |key|
- "#{ActiveSupport::JSON.encode(key.to_s)}:#{ActiveSupport::JSON.encode(self[key], options, *args)}"
- end * ','
- result << '}'
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/nil_class.rb b/activesupport/lib/active_support/json/encoders/nil_class.rb
deleted file mode 100644
index 8c51dba384..0000000000
--- a/activesupport/lib/active_support/json/encoders/nil_class.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class NilClass
- private
- def rails_to_json(*)
- 'null'
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/numeric.rb b/activesupport/lib/active_support/json/encoders/numeric.rb
deleted file mode 100644
index c7cd0df1d7..0000000000
--- a/activesupport/lib/active_support/json/encoders/numeric.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Numeric
- private
- def rails_to_json(*)
- to_s
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/object.rb b/activesupport/lib/active_support/json/encoders/object.rb
deleted file mode 100644
index 9cc12d91ac..0000000000
--- a/activesupport/lib/active_support/json/encoders/object.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'active_support/core_ext/object/instance_variables'
-
-class Object
- # Dumps object in JSON (JavaScript Object Notation). See www.json.org for more info.
- def to_json(options = nil)
- ActiveSupport::JSON.encode(self, options)
- end
-
- private
- def rails_to_json(*args)
- ActiveSupport::JSON.encode(instance_values, *args)
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/regexp.rb b/activesupport/lib/active_support/json/encoders/regexp.rb
deleted file mode 100644
index ee42db4d02..0000000000
--- a/activesupport/lib/active_support/json/encoders/regexp.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Regexp
- private
- def rails_to_json(*)
- inspect
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/string.rb b/activesupport/lib/active_support/json/encoders/string.rb
deleted file mode 100644
index 4a6b21c1c0..0000000000
--- a/activesupport/lib/active_support/json/encoders/string.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class String
- private
- def rails_to_json(*)
- ActiveSupport::JSON::Encoding.escape(self)
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/symbol.rb b/activesupport/lib/active_support/json/encoders/symbol.rb
deleted file mode 100644
index d575350a4e..0000000000
--- a/activesupport/lib/active_support/json/encoders/symbol.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Symbol
- private
- def rails_to_json(*args)
- ActiveSupport::JSON.encode(to_s, *args)
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/time.rb b/activesupport/lib/active_support/json/encoders/time.rb
deleted file mode 100644
index d434b9aace..0000000000
--- a/activesupport/lib/active_support/json/encoders/time.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require 'active_support/core_ext/time/conversions'
-
-class Time
- private
- # Returns a JSON string representing the time. If ActiveSupport.use_standard_json_time_format is set to true, the
- # ISO 8601 format is used.
- #
- # ==== Examples
- #
- # # With ActiveSupport.use_standard_json_time_format = true
- # Time.utc(2005,2,1,15,15,10).to_json
- # # => "2005-02-01T15:15:10Z"
- #
- # # With ActiveSupport.use_standard_json_time_format = false
- # Time.utc(2005,2,1,15,15,10).to_json
- # # => "2005/02/01 15:15:10 +0000"
- def rails_to_json(*)
- if ActiveSupport.use_standard_json_time_format
- xmlschema.inspect
- else
- %("#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}")
- end
- end
-end
diff --git a/activesupport/lib/active_support/json/encoders/true_class.rb b/activesupport/lib/active_support/json/encoders/true_class.rb
deleted file mode 100644
index bc25a6db78..0000000000
--- a/activesupport/lib/active_support/json/encoders/true_class.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class TrueClass
- private
- def rails_to_json(*)
- 'true'
- end
-end
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index 5fefe5b88b..907094a747 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -1,33 +1,215 @@
+# encoding: binary
+require 'active_support/core_ext/array/wrap'
+require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/object/instance_variables'
+require 'active_support/deprecation'
+
+# Hack to load json gem first so we can overwrite its to_json.
+begin
+ require 'json'
+rescue LoadError
+end
+
module ActiveSupport
+ class << self
+ delegate :use_standard_json_time_format, :use_standard_json_time_format=,
+ :escape_html_entities_in_json, :escape_html_entities_in_json=,
+ :to => :'ActiveSupport::JSON::Encoding'
+ end
+
module JSON
- class CircularReferenceError < StandardError
+ # matches YAML-formatted dates
+ DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?))$/
+
+ # Dumps object in JSON (JavaScript Object Notation). See www.json.org for more info.
+ def self.encode(value, options = nil)
+ Encoding::Encoder.new(options).encode(value)
end
- # Converts a Ruby object into a JSON string.
- def self.encode(value, options = nil, seen = nil)
- seen ||= []
- if seen.any? { |object| object.equal?(value) }
- raise CircularReferenceError, 'object references itself'
+ module Encoding #:nodoc:
+ class CircularReferenceError < StandardError; end
+
+ class Encoder
+ attr_reader :options
+
+ def initialize(options = nil)
+ @options = options
+ @seen = []
+ end
+
+ def encode(value)
+ check_for_circular_references(value) do
+ value.as_json(options).encode_json(self)
+ end
+ end
+
+ def escape(string)
+ Encoding.escape(string)
+ end
+
+ private
+ def check_for_circular_references(value)
+ if @seen.any? { |object| object.equal?(value) }
+ raise CircularReferenceError, 'object references itself'
+ end
+ @seen.unshift value
+ yield
+ ensure
+ @seen.shift
+ end
+ end
+
+
+ ESCAPED_CHARS = {
+ "\010" => '\b',
+ "\f" => '\f',
+ "\n" => '\n',
+ "\r" => '\r',
+ "\t" => '\t',
+ '"' => '\"',
+ '\\' => '\\\\',
+ '>' => '\u003E',
+ '<' => '\u003C',
+ '&' => '\u0026' }
+
+ class << self
+ # If true, use ISO 8601 format for dates and times. Otherwise, fall back to the Active Support legacy format.
+ attr_accessor :use_standard_json_time_format
+
+ attr_accessor :escape_regex
+ attr_reader :escape_html_entities_in_json
+
+ def escape_html_entities_in_json=(value)
+ self.escape_regex = \
+ if @escape_html_entities_in_json = value
+ /[\010\f\n\r\t"\\><&]/
+ else
+ /[\010\f\n\r\t"\\]/
+ end
+ end
+
+ def escape(string)
+ string = string.dup.force_encoding(::Encoding::BINARY) if string.respond_to?(:force_encoding)
+ json = '"' + string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] }
+ json.gsub(/([\xC0-\xDF][\x80-\xBF]|
+ [\xE0-\xEF][\x80-\xBF]{2}|
+ [\xF0-\xF7][\x80-\xBF]{3})+/nx) { |s|
+ s.unpack("U*").pack("n*").unpack("H*")[0].gsub(/.{4}/, '\\\\u\&')
+ } + '"'
+ end
+ end
+
+ self.escape_html_entities_in_json = true
+ end
+
+ CircularReferenceError = Deprecation::DeprecatedConstantProxy.new('ActiveSupport::JSON::CircularReferenceError', Encoding::CircularReferenceError)
+ end
+end
+
+class Object
+ # Dumps object in JSON (JavaScript Object Notation). See www.json.org for more info.
+ def to_json(options = nil)
+ ActiveSupport::JSON.encode(self, options)
+ end
+
+ def as_json(options = nil) instance_values end #:nodoc:
+end
+
+# A string that returns itself as its JSON-encoded form.
+class ActiveSupport::JSON::Variable < String
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) self end #:nodoc:
+end
+
+class TrueClass
+ AS_JSON = ActiveSupport::JSON::Variable.new('true').freeze
+ def as_json(options = nil) AS_JSON end #:nodoc:
+end
+
+class FalseClass
+ AS_JSON = ActiveSupport::JSON::Variable.new('false').freeze
+ def as_json(options = nil) AS_JSON end #:nodoc:
+end
+
+class NilClass
+ AS_JSON = ActiveSupport::JSON::Variable.new('null').freeze
+ def as_json(options = nil) AS_JSON end #:nodoc:
+end
+
+class String
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) encoder.escape(self) end #:nodoc:
+end
+
+class Symbol
+ def as_json(options = nil) to_s end #:nodoc:
+end
+
+class Numeric
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) to_s end #:nodoc:
+end
+
+class Regexp
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) inspect end #:nodoc:
+end
+
+module Enumerable
+ def as_json(options = nil) to_a end #:nodoc:
+end
+
+class Array
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) "[#{map { |v| encoder.encode(v) } * ','}]" end #:nodoc:
+end
+
+class Hash
+ def as_json(options = nil) #:nodoc:
+ if options
+ if attrs = options[:only]
+ slice(*Array.wrap(attrs))
+ elsif attrs = options[:except]
+ except(*Array.wrap(attrs))
+ else
+ self
end
- seen << value
- value.__send__(:rails_to_json, options, seen)
- ensure
- seen.pop
+ else
+ self
+ end
+ end
+
+ def encode_json(encoder)
+ "{#{map { |k,v| "#{encoder.encode(k.to_s)}:#{encoder.encode(v)}" } * ','}}"
+ end
+end
+
+class Time
+ def as_json(options = nil) #:nodoc:
+ if ActiveSupport.use_standard_json_time_format
+ xmlschema
+ else
+ %(#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
end
end
end
-require 'active_support/json/variable'
-require 'active_support/json/encoders/date'
-require 'active_support/json/encoders/date_time'
-require 'active_support/json/encoders/enumerable'
-require 'active_support/json/encoders/false_class'
-require 'active_support/json/encoders/hash'
-require 'active_support/json/encoders/nil_class'
-require 'active_support/json/encoders/numeric'
-require 'active_support/json/encoders/object'
-require 'active_support/json/encoders/regexp'
-require 'active_support/json/encoders/string'
-require 'active_support/json/encoders/symbol'
-require 'active_support/json/encoders/time'
-require 'active_support/json/encoders/true_class'
+class Date
+ def as_json(options = nil) #:nodoc:
+ if ActiveSupport.use_standard_json_time_format
+ strftime("%Y-%m-%d")
+ else
+ strftime("%Y/%m/%d")
+ end
+ end
+end
+
+class DateTime
+ def as_json(options = nil) #:nodoc:
+ if ActiveSupport.use_standard_json_time_format
+ xmlschema
+ else
+ strftime('%Y/%m/%d %H:%M:%S %z')
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb
index 58d4c47ccb..bc340fccec 100644
--- a/activesupport/lib/active_support/new_callbacks.rb
+++ b/activesupport/lib/active_support/new_callbacks.rb
@@ -91,9 +91,8 @@ module ActiveSupport
@@_callback_sequence = 0
attr_accessor :filter, :kind, :name, :options, :per_key, :klass
- def initialize(filter, kind, options, klass, name)
+ def initialize(filter, kind, options, klass)
@kind, @klass = kind, klass
- @name = name
normalize_options!(options)
@@ -131,9 +130,8 @@ module ActiveSupport
@@_callback_sequence += 1
end
- def matches?(_kind, _name, _filter)
+ def matches?(_kind, _filter)
@kind == _kind &&
- @name == _name &&
@filter == _filter
end
@@ -182,9 +180,10 @@ module ActiveSupport
filter = <<-RUBY_EVAL
unless halted
result = #{@filter}
- halted ||= (#{terminator})
+ halted = (#{terminator})
end
RUBY_EVAL
+
[@compiled_options[0], filter, @compiled_options[1]].compact.join("\n")
else
# Compile around filters with conditions into proxy methods
@@ -203,7 +202,7 @@ module ActiveSupport
# end
name = "_conditional_callback_#{@kind}_#{next_id}"
- txt = <<-RUBY_EVAL
+ txt, line = <<-RUBY_EVAL, __LINE__
def #{name}(halted)
#{@compiled_options[0] || "if true"} && !halted
#{@filter} do
@@ -214,7 +213,7 @@ module ActiveSupport
end
end
RUBY_EVAL
- @klass.class_eval(txt)
+ @klass.class_eval(txt, __FILE__, line)
"#{name}(halted) do"
end
end
@@ -284,66 +283,42 @@ module ActiveSupport
filter.map {|f| _compile_filter(f)}
when Symbol
filter
+ when String
+ "(#{filter})"
when Proc
@klass.send(:define_method, method_name, &filter)
- method_name << case filter.arity
- when 1
- "(self)"
- when 2
- " self, Proc.new "
- else
- ""
- end
- when Method
- @klass.send(:define_method, "#{method_name}_method") { filter }
+ return method_name if filter.arity == 0
+
+ method_name << (filter.arity == 1 ? "(self)" : " self, Proc.new ")
+ else
+ @klass.send(:define_method, "#{method_name}_object") { filter }
+
+ _normalize_legacy_filter(kind, filter)
+
@klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def #{method_name}(&blk)
- #{method_name}_method.call(self, &blk)
- end
- RUBY_EVAL
- method_name
- when String
- @klass.class_eval <<-RUBY_EVAL
- def #{method_name}
- #{filter}
+ #{method_name}_object.send(:#{kind}, self, &blk)
end
RUBY_EVAL
+
method_name
- else
- kind, name = @kind, @name
- @klass.send(:define_method, "#{method_name}_object") { filter }
+ end
+ end
- if kind == :around
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def #{method_name}(&blk)
- if :#{kind} == :around && #{method_name}_object.respond_to?(:filter)
- #{method_name}_object.send("filter", self, &blk)
- # TODO: Deprecate this
- elsif #{method_name}_object.respond_to?(:before) && #{method_name}_object.respond_to?(:after)
- should_continue = #{method_name}_object.before(self)
- yield if should_continue
- #{method_name}_object.after(self)
- else
- #{method_name}_object.send("#{kind}_#{name}", self, &blk)
- end
- end
- RUBY_EVAL
- else
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def #{method_name}(&blk)
- if #{method_name}_object.respond_to?(:#{kind})
- #{method_name}_object.#{kind}(self, &blk)
- elsif #{method_name}_object.respond_to?(:filter)
- #{method_name}_object.send("filter", self, &blk)
- else
- #{method_name}_object.send("#{kind}_#{name}", self, &blk)
- end
- end
- RUBY_EVAL
+ def _normalize_legacy_filter(kind, filter)
+ if !filter.respond_to?(kind) && filter.respond_to?(:filter)
+ filter.metaclass.class_eval(
+ "def #{kind}(context, &block) filter(context, &block) end",
+ __FILE__, __LINE__ - 1)
+ elsif filter.respond_to?(:before) && filter.respond_to?(:after) && kind == :around
+ def filter.around(context)
+ should_continue = before(context)
+ yield if should_continue
+ after(context)
end
- method_name
end
end
+
end
# An Array with a compile method
@@ -385,51 +360,43 @@ module ActiveSupport
# The _run_save_callbacks method can optionally take a key, which
# will be used to compile an optimized callback method for each
# key. See #define_callbacks for more information.
- def _define_runner(symbol, str, options)
- str = <<-RUBY_EVAL
- def _run_#{symbol}_callbacks(key = nil)
+ def _define_runner(symbol)
+ body = send("_#{symbol}_callbacks").
+ compile(nil, :terminator => send("_#{symbol}_terminator"))
+
+ body, line = <<-RUBY_EVAL, __LINE__
+ def _run_#{symbol}_callbacks(key = nil, &blk)
if key
- key = key.hash.to_s.gsub(/-/, '_')
- name = "_run__\#{self.class.name.split("::").last}__#{symbol}__\#{key}__callbacks"
+ name = "_run__\#{self.class.name.hash.abs}__#{symbol}__\#{key.hash.abs}__callbacks"
- if respond_to?(name)
- send(name) { yield if block_given? }
- else
- self.class._create_and_run_keyed_callback(
- self.class.name.split("::").last,
- :#{symbol}, key, self) { yield if block_given? }
+ unless respond_to?(name)
+ self.class._create_keyed_callback(name, :#{symbol}, self, &blk)
end
+
+ send(name, &blk)
else
- #{str}
+ #{body}
end
end
RUBY_EVAL
undef_method "_run_#{symbol}_callbacks" if method_defined?("_run_#{symbol}_callbacks")
- class_eval str, __FILE__, __LINE__
-
- before_name, around_name, after_name =
- options.values_at(:before, :after, :around)
+ class_eval body, __FILE__, line
end
# This is called the first time a callback is called with a particular
# key. It creates a new callback method for the key, calculating
# which callbacks can be omitted because of per_key conditions.
- def _create_and_run_keyed_callback(klass, kind, key, obj, &blk)
+ def _create_keyed_callback(name, kind, obj, &blk)
@_keyed_callbacks ||= {}
- @_keyed_callbacks[[kind, key]] ||= begin
- str = self.send("_#{kind}_callbacks").compile(key, :object => obj, :terminator => self.send("_#{kind}_terminator"))
+ @_keyed_callbacks[name] ||= begin
+ str = send("_#{kind}_callbacks").
+ compile(name, :object => obj, :terminator => send("_#{kind}_terminator"))
- self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def _run__#{klass.split("::").last}__#{kind}__#{key}__callbacks
- #{str}
- end
- RUBY_EVAL
+ class_eval "def #{name}() #{str} end", __FILE__, __LINE__
true
end
-
- obj.send("_run__#{klass.split("::").last}__#{kind}__#{key}__callbacks", &blk)
end
# Define callbacks.
@@ -463,61 +430,57 @@ module ActiveSupport
# In that case, each action_name would get its own compiled callback
# method that took into consideration the per_key conditions. This
# is a speed improvement for ActionPack.
+ def _update_callbacks(name, filters = CallbackChain.new(name), block = nil)
+ type = [:before, :after, :around].include?(filters.first) ? filters.shift : :before
+ options = filters.last.is_a?(Hash) ? filters.pop : {}
+ filters.unshift(block) if block
+
+ callbacks = send("_#{name}_callbacks")
+ yield callbacks, type, filters, options if block_given?
+
+ _define_runner(name)
+ end
+
+ alias_method :_reset_callbacks, :_update_callbacks
+
+ def set_callback(name, *filters, &block)
+ _update_callbacks(name, filters, block) do |callbacks, type, filters, options|
+ filters.map! do |filter|
+ # overrides parent class
+ callbacks.delete_if {|c| c.matches?(type, filter) }
+ Callback.new(filter, type, options.dup, self)
+ end
+
+ options[:prepend] ? callbacks.unshift(*filters) : callbacks.push(*filters)
+ end
+ end
+
+ def skip_callback(name, *filters, &block)
+ _update_callbacks(name, filters, block) do |callbacks, type, filters, options|
+ filters.each do |filter|
+ callbacks = send("_#{name}_callbacks=", callbacks.clone(self))
+
+ filter = callbacks.find {|c| c.matches?(type, filter) }
+
+ if filter && options.any?
+ filter.recompile!(options, options[:per_key] || {})
+ else
+ callbacks.delete(filter)
+ end
+ end
+ end
+ end
+
def define_callbacks(*symbols)
terminator = symbols.pop if symbols.last.is_a?(String)
symbols.each do |symbol|
- self.extlib_inheritable_accessor("_#{symbol}_terminator")
- self.send("_#{symbol}_terminator=", terminator)
- self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- extlib_inheritable_accessor :_#{symbol}_callbacks
- self._#{symbol}_callbacks = CallbackChain.new(:#{symbol})
+ extlib_inheritable_accessor("_#{symbol}_terminator") { terminator }
- def self.#{symbol}_callback(*filters, &blk)
- type = [:before, :after, :around].include?(filters.first) ? filters.shift : :before
- options = filters.last.is_a?(Hash) ? filters.pop : {}
- filters.unshift(blk) if block_given?
-
- filters.map! do |filter|
- # overrides parent class
- self._#{symbol}_callbacks.delete_if {|c| c.matches?(type, :#{symbol}, filter)}
- Callback.new(filter, type, options.dup, self, :#{symbol})
- end
- options[:prepend] ?
- self._#{symbol}_callbacks.unshift(*filters) :
- self._#{symbol}_callbacks.push(*filters)
- _define_runner(:#{symbol},
- self._#{symbol}_callbacks.compile(nil, :terminator => _#{symbol}_terminator),
- options)
- end
-
- def self.skip_#{symbol}_callback(*filters, &blk)
- type = [:before, :after, :around].include?(filters.first) ? filters.shift : :before
- options = filters.last.is_a?(Hash) ? filters.pop : {}
- filters.unshift(blk) if block_given?
- filters.each do |filter|
- self._#{symbol}_callbacks = self._#{symbol}_callbacks.clone(self)
-
- filter = self._#{symbol}_callbacks.find {|c| c.matches?(type, :#{symbol}, filter) }
- per_key = options[:per_key] || {}
- if filter && options.any?
- filter.recompile!(options, per_key)
- else
- self._#{symbol}_callbacks.delete(filter)
- end
- _define_runner(:#{symbol},
- self._#{symbol}_callbacks.compile(nil, :terminator => _#{symbol}_terminator),
- options)
- end
-
- end
-
- def self.reset_#{symbol}_callbacks
- self._#{symbol}_callbacks = CallbackChain.new(:#{symbol})
- _define_runner(:#{symbol}, self._#{symbol}_callbacks.compile, {})
- end
-
- self.#{symbol}_callback(:before)
- RUBY_EVAL
+ extlib_inheritable_accessor("_#{symbol}_callbacks") do
+ CallbackChain.new(symbol)
+ end
+
+ _define_runner(symbol)
end
end
end
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 069842c6c3..4907fae9d6 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -118,6 +118,27 @@ 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.
+ #
+ # ==== Examples
+ #
+ # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true
+ # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
+ # # => "2005-02-01T15:15:10Z"
+ #
+ # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
+ # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
+ # # => "2005/02/01 15:15:10 +0000"
+ def as_json(options = nil)
+ if ActiveSupport::JSON::Encoding.use_standard_json_time_format
+ xmlschema
+ else
+ %(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
+ end
+ end
+
def to_yaml(options = {})
if options.kind_of?(YAML::Emitter)
utc.to_yaml(options)
@@ -301,26 +322,6 @@ module ActiveSupport
end
private
- # Returns a JSON string representing the TimeWithZone. If ActiveSupport.use_standard_json_time_format is set to
- # true, the ISO 8601 format is used.
- #
- # ==== Examples
- #
- # # With ActiveSupport.use_standard_json_time_format = true
- # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
- # # => "2005-02-01T15:15:10Z"
- #
- # # With ActiveSupport.use_standard_json_time_format = false
- # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
- # # => "2005/02/01 15:15:10 +0000"
- def rails_to_json(*)
- if !ActiveSupport.respond_to?(:use_standard_json_time_format) || ActiveSupport.use_standard_json_time_format
- xmlschema.inspect
- else
- %("#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}")
- end
- end
-
def get_period_and_ensure_valid_local_time
# we don't want a Time.local instance enforcing its own DST rules as well,
# so transfer time values to a utc constructor if necessary
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index b37dae1c2a..564528bfe2 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -125,7 +125,7 @@ module ActiveSupport
"Kolkata" => "Asia/Kolkata",
"Mumbai" => "Asia/Kolkata",
"New Delhi" => "Asia/Kolkata",
- "Kathmandu" => "Asia/Katmandu",
+ "Kathmandu" => "Asia/Kathmandu",
"Astana" => "Asia/Dhaka",
"Dhaka" => "Asia/Dhaka",
"Sri Jayawardenepura" => "Asia/Colombo",
diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb
index 2be9b85c89..b6223fe20a 100644
--- a/activesupport/lib/active_support/vendor.rb
+++ b/activesupport/lib/active_support/vendor.rb
@@ -14,9 +14,9 @@ rescue Gem::LoadError
end
begin
- gem 'tzinfo', '~> 0.3.12'
+ gem 'tzinfo', '~> 0.3.13'
rescue Gem::LoadError
- $:.unshift "#{File.dirname(__FILE__)}/vendor/tzinfo-0.3.12"
+ $:.unshift "#{File.dirname(__FILE__)}/vendor/tzinfo-0.3.13"
end
# TODO I18n gem has not been released yet
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo.rb
index c8bdbeec5d..c8bdbeec5d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone.rb
index 5eccbdf0db..5eccbdf0db 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone_info.rb
index a45d94554b..a45d94554b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Algiers.rb
index 8c5f25577f..8c5f25577f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Algiers.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Cairo.rb
index 6e6daf3522..6e6daf3522 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Cairo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Casablanca.rb
index d1eb5c5724..18d73c93a0 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Casablanca.rb
@@ -33,6 +33,8 @@ module TZInfo
tz.transition 1985, 12, :o1, 504918000
tz.transition 2008, 6, :o2, 1212278400
tz.transition 2008, 8, :o1, 1220223600
+ tz.transition 2009, 6, :o2, 1243814400
+ tz.transition 2009, 8, :o1, 1250809200
end
end
end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Harare.rb
index 070c95ae0f..070c95ae0f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Harare.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Johannesburg.rb
index f0af0d8e33..f0af0d8e33 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Johannesburg.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Monrovia.rb
index 40e711fa44..40e711fa44 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Monrovia.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Nairobi.rb
index 7b0a2f43be..7b0a2f43be 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Nairobi.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/Buenos_Aires.rb
index 8f4dd31dbb..8f4dd31dbb 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/Buenos_Aires.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/San_Juan.rb
index ba8be4705f..ba8be4705f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/San_Juan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Bogota.rb
index ef96435c6a..ef96435c6a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Bogota.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Caracas.rb
index 27392a540a..27392a540a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Caracas.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chicago.rb
index 0996857cf0..0996857cf0 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chicago.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chihuahua.rb
index 1710b57c79..1710b57c79 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chihuahua.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Denver.rb
index 1c1efb5ff3..1c1efb5ff3 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Denver.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Godthab.rb
index 1e05518b0d..1e05518b0d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Godthab.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Guatemala.rb
index a2bf73401c..a2bf73401c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Guatemala.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Halifax.rb
index d25ae775b3..d25ae775b3 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Halifax.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Indiana/Indianapolis.rb
index f1430f6c24..f1430f6c24 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Indiana/Indianapolis.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Juneau.rb
index f646f3f54a..f646f3f54a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Juneau.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/La_Paz.rb
index 45c907899f..45c907899f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/La_Paz.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Lima.rb
index af68ac29f7..af68ac29f7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Lima.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Los_Angeles.rb
index 16007fd675..16007fd675 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Los_Angeles.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mazatlan.rb
index ba9e6efcf1..ba9e6efcf1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mazatlan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mexico_City.rb
index 2347fce647..2347fce647 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mexico_City.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Monterrey.rb
index 5816a9eab1..5816a9eab1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Monterrey.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/New_York.rb
index 7d802bd2de..7d802bd2de 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/New_York.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Phoenix.rb
index b514e0c0f9..b514e0c0f9 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Phoenix.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Regina.rb
index ebdb68814a..ebdb68814a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Regina.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Santiago.rb
index 0287c9ebc4..0287c9ebc4 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Santiago.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Sao_Paulo.rb
index 0524f81c04..0524f81c04 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Sao_Paulo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/St_Johns.rb
index e4a3599d35..e4a3599d35 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/St_Johns.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Tijuana.rb
index 423059da46..423059da46 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Tijuana.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Almaty.rb
index 9ee18970f1..9ee18970f1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Almaty.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baghdad.rb
index 774dca1587..774dca1587 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baghdad.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baku.rb
index e86340ebfa..e86340ebfa 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baku.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Bangkok.rb
index 139194e5e5..139194e5e5 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Bangkok.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Chongqing.rb
index 8c94b4ba86..8c94b4ba86 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Chongqing.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Colombo.rb
index f6531fa819..f6531fa819 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Colombo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Dhaka.rb
index ccd0265503..ccd0265503 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Dhaka.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Hong_Kong.rb
index f1edd75ac8..f1edd75ac8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Hong_Kong.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Irkutsk.rb
index 2d47d9580b..2d47d9580b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Irkutsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jakarta.rb
index cc58fa173b..cc58fa173b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jakarta.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jerusalem.rb
index 9b737b899e..9b737b899e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jerusalem.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kabul.rb
index 669c09790a..669c09790a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kabul.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kamchatka.rb
index 2f1690b3a9..2f1690b3a9 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kamchatka.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Karachi.rb
index b906cc9893..4f187b4ad4 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Karachi.rb
@@ -23,6 +23,8 @@ module TZInfo
tz.transition 2002, 10, :o4, 1033840860
tz.transition 2008, 5, :o5, 1212260400
tz.transition 2008, 10, :o4, 1225476000
+ tz.transition 2009, 4, :o5, 1239735600
+ tz.transition 2009, 10, :o4, 1257012000
end
end
end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kathmandu.rb
index 37dbea1f41..37b241612e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kathmandu.rb
@@ -3,10 +3,10 @@ require 'tzinfo/timezone_definition'
module TZInfo
module Definitions
module Asia
- module Katmandu
+ module Kathmandu
include TimezoneDefinition
- timezone 'Asia/Katmandu' do |tz|
+ timezone 'Asia/Kathmandu' do |tz|
tz.offset :o0, 20476, 0, :LMT
tz.offset :o1, 19800, 0, :IST
tz.offset :o2, 20700, 0, :NPT
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kolkata.rb
index 1b6ffbd59d..1b6ffbd59d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kolkata.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Krasnoyarsk.rb
index d6c503c155..d6c503c155 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Krasnoyarsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuala_Lumpur.rb
index 77a0c206fa..77a0c206fa 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuala_Lumpur.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuwait.rb
index 5bd5283197..5bd5283197 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuwait.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Magadan.rb
index 302093693e..302093693e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Magadan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Muscat.rb
index 604f651dfa..604f651dfa 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Muscat.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Novosibirsk.rb
index a4e7796e75..a4e7796e75 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Novosibirsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Rangoon.rb
index 759b82d77a..759b82d77a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Rangoon.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Riyadh.rb
index 7add410620..7add410620 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Riyadh.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Seoul.rb
index 795d2a75df..795d2a75df 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Seoul.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Shanghai.rb
index 34b13d59ae..34b13d59ae 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Shanghai.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Singapore.rb
index b323a78f74..b323a78f74 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Singapore.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Taipei.rb
index 3ba12108fb..3ba12108fb 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Taipei.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tashkent.rb
index c205c7934d..c205c7934d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tashkent.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tbilisi.rb
index 15792a5651..15792a5651 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tbilisi.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tehran.rb
index d8df964a46..d8df964a46 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tehran.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tokyo.rb
index 51c9e16421..51c9e16421 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tokyo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Ulaanbaatar.rb
index 2854f5c5fd..2854f5c5fd 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Ulaanbaatar.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Urumqi.rb
index d793ff1341..d793ff1341 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Urumqi.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Vladivostok.rb
index bd9e3d60ec..bd9e3d60ec 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Vladivostok.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yakutsk.rb
index 56435a788f..56435a788f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yakutsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yekaterinburg.rb
index 8ef8df4a41..8ef8df4a41 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yekaterinburg.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yerevan.rb
index e7f160861f..e7f160861f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yerevan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Azores.rb
index 1bd16a75ac..1bd16a75ac 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Azores.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Cape_Verde.rb
index 61c8c15043..61c8c15043 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Cape_Verde.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/South_Georgia.rb
index 6a4cbafb9f..6a4cbafb9f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/South_Georgia.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Adelaide.rb
index c5d561cc1e..c5d561cc1e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Adelaide.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Brisbane.rb
index dd85ddae94..dd85ddae94 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Brisbane.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Darwin.rb
index 17de88124d..17de88124d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Darwin.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Hobart.rb
index 11384b9840..11384b9840 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Hobart.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Melbourne.rb
index c1304488ea..c1304488ea 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Melbourne.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Perth.rb
index d9e66f14a8..d9e66f14a8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Perth.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Sydney.rb
index 9062bd7c3c..9062bd7c3c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Sydney.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Etc/UTC.rb
index 28b2c6a04c..28b2c6a04c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Etc/UTC.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Amsterdam.rb
index 2d0c95c4bc..2d0c95c4bc 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Amsterdam.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Athens.rb
index 4e21e535ca..4e21e535ca 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Athens.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Belgrade.rb
index 4dbd893d75..4dbd893d75 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Belgrade.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Berlin.rb
index 721054236c..721054236c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Berlin.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bratislava.rb
index 7a731a0b6a..7a731a0b6a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bratislava.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Brussels.rb
index 6b0a242944..6b0a242944 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Brussels.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bucharest.rb
index 521c3c932e..521c3c932e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bucharest.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Budapest.rb
index 1f3a9738b7..1f3a9738b7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Budapest.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Copenhagen.rb
index 47cbaf14a7..47cbaf14a7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Copenhagen.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Dublin.rb
index 0560bb5436..0560bb5436 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Dublin.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Helsinki.rb
index 13a806bcc7..13a806bcc7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Helsinki.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Istanbul.rb
index 8306c47536..8306c47536 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Istanbul.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Kiev.rb
index 513d3308be..513d3308be 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Kiev.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Lisbon.rb
index 1c6d2a3d30..1c6d2a3d30 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Lisbon.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Ljubljana.rb
index a9828e6ef8..a9828e6ef8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Ljubljana.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/London.rb
index 64ce41e900..64ce41e900 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/London.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Madrid.rb
index 1fb568239a..1fb568239a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Madrid.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Minsk.rb
index fa15816cc8..fa15816cc8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Minsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Moscow.rb
index ef269b675b..ef269b675b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Moscow.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Paris.rb
index e3236c0ba1..e3236c0ba1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Paris.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Prague.rb
index bcabee96c1..bcabee96c1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Prague.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Riga.rb
index 784837f758..784837f758 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Riga.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Rome.rb
index aa7b43d9d2..aa7b43d9d2 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Rome.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sarajevo.rb
index 068c5fe6ad..068c5fe6ad 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sarajevo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Skopje.rb
index 10b71f285e..10b71f285e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Skopje.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sofia.rb
index 38a70eceb9..38a70eceb9 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sofia.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Stockholm.rb
index 43db70fa61..43db70fa61 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Stockholm.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Tallinn.rb
index de5a8569f3..de5a8569f3 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Tallinn.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vienna.rb
index 990aabab66..990aabab66 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vienna.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vilnius.rb
index d89d095a75..d89d095a75 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vilnius.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Warsaw.rb
index 7fa51c2691..7fa51c2691 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Warsaw.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Zagreb.rb
index ecdd903d28..ecdd903d28 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Zagreb.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Auckland.rb
index a524fd6b6b..a524fd6b6b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Auckland.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Fiji.rb
index 5fe9bbd9a6..5fe9bbd9a6 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Fiji.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Guam.rb
index d4c1a0a682..d4c1a0a682 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Guam.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Honolulu.rb
index 204b226537..204b226537 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Honolulu.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Majuro.rb
index 32adad92c1..32adad92c1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Majuro.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Midway.rb
index 97784fcc10..97784fcc10 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Midway.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Noumea.rb
index 70173db8ab..70173db8ab 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Noumea.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Pago_Pago.rb
index c8fcd7d527..c8fcd7d527 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Pago_Pago.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Port_Moresby.rb
index f06cf6d54f..f06cf6d54f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Port_Moresby.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Tongatapu.rb
index 7578d92f38..7578d92f38 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Tongatapu.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/info_timezone.rb
index 001303c594..001303c594 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/info_timezone.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone.rb
index f8ec4fca87..f8ec4fca87 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone_info.rb
index 8197ff3e81..8197ff3e81 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/offset_rationals.rb
index b1f10b2b63..b1f10b2b63 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/offset_rationals.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/ruby_core_support.rb
index 9a0441206b..9a0441206b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/ruby_core_support.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/time_or_datetime.rb
index 264517f3ee..264517f3ee 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/time_or_datetime.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone.rb
index f87fb6fb70..ef4ecd8ae1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone.rb
@@ -82,7 +82,7 @@ module TZInfo
identifier = identifier.gsub(/-/, '__m__').gsub(/\+/, '__p__')
begin
# Use a temporary variable to avoid an rdoc warning
- file = "tzinfo/definitions/#{identifier}"
+ file = "tzinfo/definitions/#{identifier}".untaint
require file
m = Definitions
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_definition.rb
index 39ca8bfa53..39ca8bfa53 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_definition.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_info.rb
index 68e38c35fb..68e38c35fb 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_offset_info.rb
index 6a0bbca46f..6a0bbca46f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_offset_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_period.rb
index 00888fcfdc..00888fcfdc 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_period.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_transition_info.rb
index 6b0669cc4a..6b0669cc4a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_transition_info.rb
diff --git a/activesupport/test/core_ext/module/model_naming_test.rb b/activesupport/test/core_ext/module/model_naming_test.rb
index da3b6c4932..37119f378a 100644
--- a/activesupport/test/core_ext/module/model_naming_test.rb
+++ b/activesupport/test/core_ext/module/model_naming_test.rb
@@ -14,6 +14,14 @@ class ModelNamingTest < Test::Unit::TestCase
assert_equal 'post_track_backs', @model_name.plural
end
+ def test_element
+ assert_equal 'track_back', @model_name.element
+ end
+
+ def test_collection
+ assert_equal 'post/track_backs', @model_name.collection
+ end
+
def test_partial_path
assert_equal 'post/track_backs/track_back', @model_name.partial_path
end
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 237a843f9a..6991b174b7 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -112,6 +112,8 @@ class StringInflectionsTest < Test::Unit::TestCase
def test_string_to_time
assert_equal Time.utc(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time
assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time(:local)
+ assert_equal Time.utc(2005, 2, 27, 23, 50, 19, 275038), "2005-02-27T23:50:19.275038".to_time
+ assert_equal Time.local(2005, 2, 27, 23, 50, 19, 275038), "2005-02-27T23:50:19.275038".to_time(:local)
assert_equal DateTime.civil(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_time
assert_equal Time.local_time(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_time(:local)
end
@@ -120,6 +122,7 @@ class StringInflectionsTest < Test::Unit::TestCase
assert_equal DateTime.civil(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_datetime
assert_equal 0, "2039-02-27 23:50".to_datetime.offset # use UTC offset
assert_equal ::Date::ITALY, "2039-02-27 23:50".to_datetime.start # use Ruby's default start value
+ assert_equal DateTime.civil(2039, 2, 27, 23, 50, 19 + Rational(275038, 1000000), "-04:00"), "2039-02-27T23:50:19.275038-04:00".to_datetime
end
def test_string_to_date
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index 03ae70d420..bb60968a4f 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'active_support/time_with_zone'
+require 'active_support/time'
require 'active_support/json'
class TimeWithZoneTest < Test::Unit::TestCase
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index 1a0e6d543c..983235d06c 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -9,6 +9,12 @@ class TestJSONEncoding < Test::Unit::TestCase
end
end
+ class Custom
+ def as_json(options)
+ 'custom'
+ end
+ end
+
TrueTests = [[ true, %(true) ]]
FalseTests = [[ false, %(false) ]]
NilTests = [[ nil, %(null) ]]
@@ -27,6 +33,7 @@ class TestJSONEncoding < Test::Unit::TestCase
[ :"a b", %("a b") ]]
ObjectTests = [[ Foo.new(1, 2), %({\"a\":1,\"b\":2}) ]]
+ CustomTests = [[ Custom.new, '"custom"' ]]
VariableTests = [[ ActiveSupport::JSON::Variable.new('foo'), 'foo'],
[ ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")']]
@@ -76,7 +83,7 @@ class TestJSONEncoding < Test::Unit::TestCase
def test_exception_raised_when_encoding_circular_reference
a = [1]
a << a
- assert_raise(ActiveSupport::JSON::CircularReferenceError) { ActiveSupport::JSON.encode(a) }
+ assert_raise(ActiveSupport::JSON::Encoding::CircularReferenceError) { ActiveSupport::JSON.encode(a) }
end
def test_hash_key_identifiers_are_always_quoted
@@ -129,11 +136,9 @@ end
class JsonOptionsTests < Test::Unit::TestCase
def test_enumerable_should_passthrough_options_to_elements
- json_options = { :include => :posts }
- ActiveSupport::JSON.expects(:encode).with(1, json_options)
- ActiveSupport::JSON.expects(:encode).with(2, json_options)
- ActiveSupport::JSON.expects(:encode).with('foo', json_options)
-
- [1, 2, 'foo'].send(:rails_to_json, json_options)
+ value, options = Object.new, Object.new
+ def value.as_json(options) options end
+ def options.encode_json(encoder) self end
+ assert_equal options, ActiveSupport::JSON.encode(value, options)
end
end
diff --git a/activesupport/test/new_callback_inheritance_test.rb b/activesupport/test/new_callback_inheritance_test.rb
index 95020389b0..da0c19eaea 100644
--- a/activesupport/test/new_callback_inheritance_test.rb
+++ b/activesupport/test/new_callback_inheritance_test.rb
@@ -11,8 +11,8 @@ class GrandParent
end
define_callbacks :dispatch
- dispatch_callback :before, :before1, :before2, :per_key => {:if => proc {|c| c.action_name == "index" || c.action_name == "update" }}
- dispatch_callback :after, :after1, :after2, :per_key => {:if => proc {|c| c.action_name == "update" || c.action_name == "delete" }}
+ set_callback :dispatch, :before, :before1, :before2, :per_key => {:if => proc {|c| c.action_name == "index" || c.action_name == "update" }}
+ set_callback :dispatch, :after, :after1, :after2, :per_key => {:if => proc {|c| c.action_name == "update" || c.action_name == "delete" }}
def before1
@log << "before1"
@@ -39,12 +39,12 @@ class GrandParent
end
class Parent < GrandParent
- skip_dispatch_callback :before, :before2, :per_key => {:unless => proc {|c| c.action_name == "update" }}
- skip_dispatch_callback :after, :after2, :per_key => {:unless => proc {|c| c.action_name == "delete" }}
+ skip_callback :dispatch, :before, :before2, :per_key => {:unless => proc {|c| c.action_name == "update" }}
+ skip_callback :dispatch, :after, :after2, :per_key => {:unless => proc {|c| c.action_name == "delete" }}
end
class Child < GrandParent
- skip_dispatch_callback :before, :before2, :per_key => {:unless => proc {|c| c.action_name == "update" }}, :if => :state_open?
+ skip_callback :dispatch, :before, :before2, :per_key => {:unless => proc {|c| c.action_name == "update" }}, :if => :state_open?
def state_open?
@state == :open
diff --git a/activesupport/test/new_callbacks_test.rb b/activesupport/test/new_callbacks_test.rb
index 7bec47224d..7e092b5f63 100644
--- a/activesupport/test/new_callbacks_test.rb
+++ b/activesupport/test/new_callbacks_test.rb
@@ -10,11 +10,11 @@ module NewCallbacksTest
define_callbacks :save
def self.before_save(*filters, &blk)
- save_callback(:before, *filters, &blk)
+ set_callback(:save, :before, *filters, &blk)
end
def self.after_save(*filters, &blk)
- save_callback(:after, *filters, &blk)
+ set_callback(:save, :after, *filters, &blk)
end
class << self
@@ -37,7 +37,7 @@ module NewCallbacksTest
def callback_object(callback_method)
klass = Class.new
klass.send(:define_method, callback_method) do |model|
- model.history << [callback_method, :object]
+ model.history << [:"#{callback_method}_save", :object]
end
klass.new
end
@@ -54,7 +54,7 @@ module NewCallbacksTest
send(callback_method, callback_symbol(callback_method_sym))
send(callback_method, callback_string(callback_method_sym))
send(callback_method, callback_proc(callback_method_sym))
- send(callback_method, callback_object(callback_method_sym))
+ send(callback_method, callback_object(callback_method_sym.to_s.gsub(/_save/, '')))
send(callback_method) { |model| model.history << [callback_method_sym, :block] }
end
@@ -64,10 +64,10 @@ module NewCallbacksTest
end
class PersonSkipper < Person
- skip_save_callback :before, :before_save_method, :if => :yes
- skip_save_callback :after, :before_save_method, :unless => :yes
- skip_save_callback :after, :before_save_method, :if => :no
- skip_save_callback :before, :before_save_method, :unless => :no
+ skip_callback :save, :before, :before_save_method, :if => :yes
+ skip_callback :save, :after, :before_save_method, :unless => :yes
+ skip_callback :save, :after, :before_save_method, :if => :no
+ skip_callback :save, :before, :before_save_method, :unless => :no
def yes; true; end
def no; false; end
end
@@ -77,8 +77,8 @@ module NewCallbacksTest
define_callbacks :dispatch
- dispatch_callback :before, :log, :per_key => {:unless => proc {|c| c.action_name == :index || c.action_name == :show }}
- dispatch_callback :after, :log2
+ set_callback :dispatch, :before, :log, :per_key => {:unless => proc {|c| c.action_name == :index || c.action_name == :show }}
+ set_callback :dispatch, :after, :log2
attr_reader :action_name, :logger
def initialize(action_name)
@@ -102,8 +102,8 @@ module NewCallbacksTest
end
class Child < ParentController
- skip_dispatch_callback :before, :log, :per_key => {:if => proc {|c| c.action_name == :update} }
- skip_dispatch_callback :after, :log2
+ skip_callback :dispatch, :before, :log, :per_key => {:if => proc {|c| c.action_name == :update} }
+ skip_callback :dispatch, :after, :log2
end
class OneTimeCompile < Record
@@ -188,19 +188,19 @@ module NewCallbacksTest
class AroundPerson < MySuper
attr_reader :history
- save_callback :before, :nope, :if => :no
- save_callback :before, :nope, :unless => :yes
- save_callback :after, :tweedle
- save_callback :before, "tweedle_dee"
- save_callback :before, proc {|m| m.history << "yup" }
- save_callback :before, :nope, :if => proc { false }
- save_callback :before, :nope, :unless => proc { true }
- save_callback :before, :yup, :if => proc { true }
- save_callback :before, :yup, :unless => proc { false }
- save_callback :around, :tweedle_dum
- save_callback :around, :w0tyes, :if => :yes
- save_callback :around, :w0tno, :if => :no
- save_callback :around, :tweedle_deedle
+ set_callback :save, :before, :nope, :if => :no
+ set_callback :save, :before, :nope, :unless => :yes
+ set_callback :save, :after, :tweedle
+ set_callback :save, :before, "tweedle_dee"
+ set_callback :save, :before, proc {|m| m.history << "yup" }
+ set_callback :save, :before, :nope, :if => proc { false }
+ set_callback :save, :before, :nope, :unless => proc { true }
+ set_callback :save, :before, :yup, :if => proc { true }
+ set_callback :save, :before, :yup, :unless => proc { false }
+ set_callback :save, :around, :tweedle_dum
+ set_callback :save, :around, :w0tyes, :if => :yes
+ set_callback :save, :around, :w0tno, :if => :no
+ set_callback :save, :around, :tweedle_deedle
def no; false; end
def yes; true; end
@@ -260,7 +260,7 @@ module NewCallbacksTest
define_callbacks :save
attr_reader :stuff
- save_callback :before, :omg, :per_key => {:if => :yes}
+ set_callback :save, :before, :omg, :per_key => {:if => :yes}
def yes() true end
@@ -354,15 +354,15 @@ module NewCallbacksTest
define_callbacks :save, "result == :halt"
- save_callback :before, :first
- save_callback :before, :second
- save_callback :around, :around_it
- save_callback :before, :third
- save_callback :after, :first
- save_callback :around, :around_it
- save_callback :after, :second
- save_callback :around, :around_it
- save_callback :after, :third
+ set_callback :save, :before, :first
+ set_callback :save, :before, :second
+ set_callback :save, :around, :around_it
+ set_callback :save, :before, :third
+ set_callback :save, :after, :first
+ set_callback :save, :around, :around_it
+ set_callback :save, :after, :second
+ set_callback :save, :around, :around_it
+ set_callback :save, :after, :third
attr_reader :history, :saved
@@ -397,11 +397,11 @@ module NewCallbacksTest
end
class CallbackObject
- def before_save(caller)
+ def before(caller)
caller.record << "before"
end
- def around_save(caller)
+ def around(caller)
caller.record << "around before"
yield
caller.record << "around after"
@@ -412,7 +412,7 @@ module NewCallbacksTest
include ActiveSupport::NewCallbacks
define_callbacks :save
- save_callback :before, CallbackObject.new
+ set_callback :save, :before, CallbackObject.new
attr_accessor :record
def initialize
@@ -430,7 +430,7 @@ module NewCallbacksTest
include ActiveSupport::NewCallbacks
define_callbacks :save
- save_callback :around, CallbackObject.new
+ set_callback :save, :around, CallbackObject.new
attr_accessor :record
def initialize
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index 7273cea0c5..9148bddaf2 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -304,7 +304,7 @@ module Rails
end
def load_gems
- unless $gems_build_rake_task
+ unless $gems_rake_task
@configuration.gems.each { |gem| gem.load }
end
end
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb
index ee3d0d81ba..3a82202bd0 100644
--- a/railties/lib/rails/gem_dependency.rb
+++ b/railties/lib/rails/gem_dependency.rb
@@ -29,11 +29,18 @@ module Rails
end
end
- def self.from_directory_name(directory_name)
+ def self.from_directory_name(directory_name, load_spec=true)
directory_name_parts = File.basename(directory_name).split('-')
name = directory_name_parts[0..-2].join('-')
version = directory_name_parts.last
- self.new(name, :version => version)
+ result = self.new(name, :version => version)
+ spec_filename = File.join(unpacked_path, directory_name, '.specification')
+ if load_spec
+ raise "Missing specification file in #{File.dirname(spec_filename)}. Perhaps you need to do a 'rake gems:refresh_specs'?" unless File.exists?(spec_filename)
+ spec = YAML::load_file(spec_filename)
+ result.specification = spec
+ end
+ result
rescue ArgumentError => e
raise "Unable to determine gem name and version from '#{directory_name}'"
end
@@ -104,6 +111,10 @@ module Rails
end
end
+ def specification=(s)
+ @spec = s
+ end
+
def requirement
r = version_requirements
(r == Gem::Requirement.default) ? nil : r
@@ -170,13 +181,14 @@ module Rails
def build(options={})
require 'rails/gem_builder'
+ return if specification.nil?
if options[:force] || !built?
return unless File.exists?(unpacked_specification_filename)
spec = YAML::load_file(unpacked_specification_filename)
Rails::GemBuilder.new(spec, unpacked_gem_directory).build_extensions
puts "Built gem: '#{unpacked_gem_directory}'"
end
- dependencies.each { |dep| dep.build }
+ dependencies.each { |dep| dep.build(options) }
end
def install
@@ -236,7 +248,7 @@ module Rails
real_spec = Gem::Specification.load(specification.loaded_from)
write_specification(real_spec)
end
- dependencies.each { |dep| dep.unpack } if options[:recursive]
+ dependencies.each { |dep| dep.unpack(options) } if options[:recursive]
end
def write_specification(spec)
diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake
index e496e1a04f..f1c34c7cca 100644
--- a/railties/lib/tasks/gems.rake
+++ b/railties/lib/tasks/gems.rake
@@ -20,7 +20,7 @@ namespace :gems do
desc "Build any native extensions for unpacked gems"
task :build do
$gems_build_rake_task = true
- frozen_gems.each {|gem| gem.build }
+ frozen_gems.each { |gem| gem.build }
end
namespace :build do
@@ -33,12 +33,12 @@ namespace :gems do
desc "Installs all required gems."
task :install => :base do
- current_gems.each {|gem| gem.install }
+ current_gems.each { |gem| gem.install }
end
desc "Unpacks all required gems into vendor/gems."
task :unpack => :install do
- current_gems.each {|gem| gem.unpack }
+ current_gems.each { |gem| gem.unpack }
end
namespace :unpack do
@@ -49,8 +49,8 @@ namespace :gems do
end
desc "Regenerate gem specifications in correct format."
- task :refresh_specs => :base do
- current_gems.each {|gem| gem.refresh }
+ task :refresh_specs do
+ frozen_gems(false).each { |gem| gem.refresh }
end
end
@@ -60,9 +60,9 @@ def current_gems
gems
end
-def frozen_gems
+def frozen_gems(load_specs=true)
Dir[File.join(RAILS_ROOT, 'vendor', 'gems', '*-*')].map do |gem_dir|
- Rails::GemDependency.from_directory_name(gem_dir)
+ Rails::GemDependency.from_directory_name(gem_dir, load_specs)
end
end
diff --git a/railties/test/gem_dependency_test.rb b/railties/test/gem_dependency_test.rb
index ff27af5572..195494a926 100644
--- a/railties/test/gem_dependency_test.rb
+++ b/railties/test/gem_dependency_test.rb
@@ -166,8 +166,14 @@ class GemDependencyTest < Test::Unit::TestCase
dummy_gem.unpack
end
+ def test_gem_from_directory_name_attempts_to_load_specification
+ assert_raises RuntimeError do
+ dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem-1.1')
+ end
+ end
+
def test_gem_from_directory_name
- dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem-1.1')
+ dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem-1.1', false)
assert_equal 'dummy-gem', dummy_gem.name
assert_equal '= 1.1', dummy_gem.version_requirements.to_s
end
@@ -187,4 +193,12 @@ class GemDependencyTest < Test::Unit::TestCase
assert_equal false, Rails::GemDependency.new("dummy-gem-j").built?
end
+ def test_gem_build_passes_options_to_dependencies
+ start_gem = Rails::GemDependency.new("dummy-gem-g")
+ dep_gem = Rails::GemDependency.new("dummy-gem-f")
+ start_gem.stubs(:dependencies).returns([dep_gem])
+ dep_gem.expects(:build).with({ :force => true }).once
+ start_gem.build(:force => true)
+ end
+
end