diff options
-rw-r--r-- | activemodel/lib/active_model/callbacks.rb | 3 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations/numericality.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 3 | ||||
-rw-r--r-- | activesupport/lib/active_support/duration.rb | 4 | ||||
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 4 | ||||
-rw-r--r-- | guides/source/4_2_release_notes.md | 2 | ||||
-rw-r--r-- | guides/source/configuring.md | 30 | ||||
-rw-r--r-- | guides/source/testing.md | 1 |
8 files changed, 32 insertions, 17 deletions
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb index b27a39b787..b3d70dc515 100644 --- a/activemodel/lib/active_model/callbacks.rb +++ b/activemodel/lib/active_model/callbacks.rb @@ -97,6 +97,9 @@ module ActiveModel # # obj is the MyModel instance that the callback is being called on # end # end + # + # NOTE: +method_name+ passed to `define_model_callbacks` must not end with + # `!`, `?` or `=`. def define_model_callbacks(*callbacks) options = callbacks.extract_options! options = { diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb index 5bd162433d..13d6a966c0 100644 --- a/activemodel/lib/active_model/validations/numericality.rb +++ b/activemodel/lib/active_model/validations/numericality.rb @@ -67,7 +67,7 @@ module ActiveModel end def parse_raw_value_as_an_integer(raw_value) - raw_value.to_i if raw_value.to_s =~ /\A[+-]?\d+\Z/ + raw_value.to_i if raw_value.to_s =~ /\A[+-]?\d+\z/ end def filtered_options(value) diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 0c8c1d7dfb..4bc13f20ca 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -719,6 +719,9 @@ module ActiveSupport # define_callbacks :save, scope: [:name] # # would call <tt>Audit#save</tt>. + # + # NOTE: +method_name+ passed to `define_model_callbacks` must not end with + # `!`, `?` or `=`. def define_callbacks(*names) options = names.extract_options! diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb index e861a17426..584fc1e1c5 100644 --- a/activesupport/lib/active_support/duration.rb +++ b/activesupport/lib/active_support/duration.rb @@ -63,6 +63,10 @@ module ActiveSupport Duration === other && other.value.eql?(value) end + def hash + @value.hash + end + def self.===(other) #:nodoc: other.is_a?(Duration) rescue ::NoMethodError diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index f4d504914e..5a2af7f943 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -196,4 +196,8 @@ class DurationTest < ActiveSupport::TestCase assert_respond_to 1.day, :since assert_respond_to 1.day, :zero? end + + def test_hash + assert_equal 1.minute.hash, 60.seconds.hash + end end diff --git a/guides/source/4_2_release_notes.md b/guides/source/4_2_release_notes.md index bace0b4c6c..a598c7c319 100644 --- a/guides/source/4_2_release_notes.md +++ b/guides/source/4_2_release_notes.md @@ -79,7 +79,7 @@ post.comments(true) # uses cached pattern The caching is not used in the following scenarios: - The model has a default scope -- The model uses single table inheritence to inherit from another model +- The model uses single table inheritance to inherit from another model - `find` with a list of ids. eg: ```ruby diff --git a/guides/source/configuring.md b/guides/source/configuring.md index 7b9710bcd8..be0478653b 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -368,24 +368,24 @@ encrypted cookies salt value. Defaults to `'signed encrypted cookie'`. ```ruby config.action_dispatch.rescue_responses = { - 'ActionController::RoutingError' => :not_found, - 'AbstractController::ActionNotFound' => :not_found, - 'ActionController::MethodNotAllowed' => :method_not_allowed, - 'ActionController::UnknownHttpMethod' => :method_not_allowed, - 'ActionController::NotImplemented' => :not_implemented, - 'ActionController::UnknownFormat' => :not_acceptable, - 'ActionController::InvalidAuthenticityToken' => :unprocessable_entity, - 'ActionDispatch::ParamsParser::ParseError' => :bad_request, - 'ActionController::BadRequest' => :bad_request, - 'ActionController::ParameterMissing' => :bad_request, - 'ActiveRecord::RecordNotFound' => :not_found, - 'ActiveRecord::StaleObjectError' => :conflict, - 'ActiveRecord::RecordInvalid' => :unprocessable_entity, - 'ActiveRecord::RecordNotSaved' => :unprocessable_entity + 'ActionController::RoutingError' => :not_found, + 'AbstractController::ActionNotFound' => :not_found, + 'ActionController::MethodNotAllowed' => :method_not_allowed, + 'ActionController::UnknownHttpMethod' => :method_not_allowed, + 'ActionController::NotImplemented' => :not_implemented, + 'ActionController::UnknownFormat' => :not_acceptable, + 'ActionController::InvalidAuthenticityToken' => :unprocessable_entity, + 'ActionDispatch::ParamsParser::ParseError' => :bad_request, + 'ActionController::BadRequest' => :bad_request, + 'ActionController::ParameterMissing' => :bad_request, + 'ActiveRecord::RecordNotFound' => :not_found, + 'ActiveRecord::StaleObjectError' => :conflict, + 'ActiveRecord::RecordInvalid' => :unprocessable_entity, + 'ActiveRecord::RecordNotSaved' => :unprocessable_entity } ``` - Any execptions that are not configured will be assigned to 500 Internal server error. + Any exceptions that are not configured will be mapped to 500 Internal Server Error. * `ActionDispatch::Callbacks.before` takes a block of code to run before the request. diff --git a/guides/source/testing.md b/guides/source/testing.md index 29724ae011..b784098fbb 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -797,6 +797,7 @@ when you initiate a Rails project. | `rake test:functionals` | Runs all the functional tests from `test/controllers`, `test/mailers`, and `test/functional` | | `rake test:helpers` | Runs all the helper tests from `test/helpers` | | `rake test:integration` | Runs all the integration tests from `test/integration` | +| `rake test:jobs` | Runs all the job tests from `test/jobs` | | `rake test:mailers` | Runs all the mailer tests from `test/mailers` | | `rake test:models` | Runs all the model tests from `test/models` | | `rake test:units` | Runs all the unit tests from `test/models`, `test/helpers`, and `test/unit` | |