From 92a6cf0acd5615730b15b9bd1aac819562696262 Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Sat, 14 Apr 2012 10:35:44 +0300 Subject: Improve example in initializer --- activemodel/lib/active_model/model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/model.rb b/activemodel/lib/active_model/model.rb index 6825fdc653..7323714ba8 100644 --- a/activemodel/lib/active_model/model.rb +++ b/activemodel/lib/active_model/model.rb @@ -42,7 +42,7 @@ module ActiveModel # include ActiveModel::Model # attr_accessor :id, :name, :omg # - # def initialize(attributes) + # def initialize(attributes={}) # super # @omg ||= true # end -- cgit v1.2.3 From 0631b2631601b30d8fedaefb7388da8b42c83977 Mon Sep 17 00:00:00 2001 From: Michael de Silva Date: Sat, 14 Apr 2012 11:58:43 +0300 Subject: fix bad format [ci skip] --- activemodel/lib/active_model/model.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/model.rb b/activemodel/lib/active_model/model.rb index 7323714ba8..3af95b09b0 100644 --- a/activemodel/lib/active_model/model.rb +++ b/activemodel/lib/active_model/model.rb @@ -2,11 +2,11 @@ module ActiveModel # == Active Model Basic Model # - # Includes the required interface for an object to interact with +ActionPack+, - # using different +ActiveModel+ modules. It includes model name introspections, + # Includes the required interface for an object to interact with ActionPack, + # using different ActiveModel modules. It includes model name introspections, # conversions, translations and validations. Besides that, it allows you to # initialize the object with a hash of attributes, pretty much like - # +ActiveRecord+ does. + # ActiveRecord does. # # A minimal implementation could be: # @@ -19,8 +19,8 @@ module ActiveModel # person.name # => 'bob' # person.age # => 18 # - # Note that, by default, +ActiveModel::Model+ implements +persisted?+ to - # return +false+, which is the most common case. You may want to override it + # Note that, by default, ActiveModel::Model implements persisted? to + # return false, which is the most common case. You may want to override it # in your class to simulate a different scenario: # # class Person @@ -35,7 +35,7 @@ module ActiveModel # person = Person.new(:id => 1, :name => 'bob') # person.persisted? # => true # - # Also, if for some reason you need to run code on +initialize+, make sure you + # Also, if for some reason you need to run code on initialize, make sure you # call super if you want the attributes hash initialization to happen. # # class Person @@ -52,7 +52,7 @@ module ActiveModel # person.omg # => true # # For more detailed information on other functionalities available, please refer - # to the specific modules included in +ActiveModel::Model+ (see below). + # to the specific modules included in ActiveModel::Model (see below). module Model def self.included(base) base.class_eval do -- cgit v1.2.3 From 6e8a1bd0d3bb602252a9ff6e77dcf9cf64261aaf Mon Sep 17 00:00:00 2001 From: Jan Xie Date: Sun, 15 Apr 2012 20:42:58 +0800 Subject: fix ActiveModel::Validations::Callbacks doc --- activemodel/lib/active_model/validations/callbacks.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/validations/callbacks.rb b/activemodel/lib/active_model/validations/callbacks.rb index c39c85e1af..dbafd0bd1a 100644 --- a/activemodel/lib/active_model/validations/callbacks.rb +++ b/activemodel/lib/active_model/validations/callbacks.rb @@ -8,7 +8,8 @@ module ActiveModel # Provides an interface for any class to have before_validation and # after_validation callbacks. # - # First, extend ActiveModel::Callbacks from the class you are creating: + # First, include ActiveModel::Validations::Callbacks from the class you are + # creating: # # class MyModel # include ActiveModel::Validations::Callbacks -- cgit v1.2.3 From 0c948a587d5fd22d0d0465d81ced2be9b903a6f6 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Tue, 17 Apr 2012 19:02:40 +0300 Subject: Fix confusing example in ActiveModel::Errors --- activemodel/lib/active_model/errors.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 016bf87d86..0c628c33c2 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -130,12 +130,12 @@ module ActiveModel # has more than one error message, yields once for each error message. # # p.errors.add(:name, "can't be blank") - # p.errors.each do |attribute, errors_array| + # p.errors.each do |attribute, error| # # Will yield :name and "can't be blank" # end # # p.errors.add(:name, "must be specified") - # p.errors.each do |attribute, errors_array| + # p.errors.each do |attribute, error| # # Will yield :name and "can't be blank" # # then yield :name and "must be specified" # end -- cgit v1.2.3