From f20208842ab1f5f6f44b08bda5beb35985c5dd5e Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Sat, 9 Jun 2012 16:04:01 -0300 Subject: Make observer enable/disable documentation more informative. * Moved the simplest case--enable/disable all on all--to the top. * Made clear what "ORM" means to avoid having to teach people how to solve "uninitialized constant ORM" errors in their test reports. --- activemodel/lib/active_model/observer_array.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'activemodel/lib/active_model') diff --git a/activemodel/lib/active_model/observer_array.rb b/activemodel/lib/active_model/observer_array.rb index 3d463885be..8de6918d18 100644 --- a/activemodel/lib/active_model/observer_array.rb +++ b/activemodel/lib/active_model/observer_array.rb @@ -17,6 +17,11 @@ module ActiveModel # Disables one or more observers. This supports multiple forms: # + # ORM.observers.disable :all + # # => disables all observers for all models subclassed from + # # an ORM base class that includes ActiveModel::Observing + # # e.g. ActiveRecord::Base + # # ORM.observers.disable :user_observer # # => disables the UserObserver # @@ -27,9 +32,6 @@ module ActiveModel # ORM.observers.disable :observer_1, :observer_2 # # => disables Observer1 and Observer2 for all models. # - # ORM.observers.disable :all - # # => disables all observers for all models. - # # User.observers.disable :all do # # all user observers are disabled for # # just the duration of the block @@ -40,6 +42,11 @@ module ActiveModel # Enables one or more observers. This supports multiple forms: # + # ORM.observers.enable :all + # # => enables all observers for all models subclassed from + # # an ORM base class that includes ActiveModel::Observing + # # e.g. ActiveRecord::Base + # # ORM.observers.enable :user_observer # # => enables the UserObserver # @@ -51,9 +58,6 @@ module ActiveModel # ORM.observers.enable :observer_1, :observer_2 # # => enables Observer1 and Observer2 for all models. # - # ORM.observers.enable :all - # # => enables all observers for all models. - # # User.observers.enable :all do # # all user observers are enabled for # # just the duration of the block -- cgit v1.2.3 From 588bb6b987bd3f10b97ce27263e8d7702605a187 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 12 Jun 2012 02:29:21 +0900 Subject: Range#cover? is not implemented in AS now --- activemodel/lib/active_model/validations/exclusion.rb | 3 +-- activemodel/lib/active_model/validations/inclusion.rb | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'activemodel/lib/active_model') diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb index 4f09679541..edd42d85f2 100644 --- a/activemodel/lib/active_model/validations/exclusion.rb +++ b/activemodel/lib/active_model/validations/exclusion.rb @@ -30,8 +30,7 @@ module ActiveModel # * :in - An enumerable object of items that the value shouldn't be # part of. This can be supplied as a proc or lambda which returns an # enumerable. If the enumerable is a range the test is performed with - # Range#cover? (backported in Active Support for 1.8), otherwise - # with include?. + # Range#cover?, otherwise with include?. # * :message - Specifies a custom error message (default is: "is # reserved"). # * :allow_nil - If set to true, skips this validation if the attribute diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb index ffdbed0fc1..8810f2a3c1 100644 --- a/activemodel/lib/active_model/validations/inclusion.rb +++ b/activemodel/lib/active_model/validations/inclusion.rb @@ -28,8 +28,8 @@ module ActiveModel # Configuration options: # * :in - An enumerable object of available items. This can be # supplied as a proc or lambda which returns an enumerable. If the enumerable - # is a range the test is performed with Range#cover? - # (backported in Active Support for 1.8), otherwise with include?. + # is a range the test is performed with Range#cover?, otherwise with + # include?. # * :message - Specifies a custom error message (default is: "is not # included in the list"). # * :allow_nil - If set to true, skips this validation if the attribute -- cgit v1.2.3