mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
cleanup, remove broken whitespace
This commit is contained in:
parent
e95b9d6c68
commit
b7edbc718b
4 changed files with 9 additions and 9 deletions
|
@ -8,7 +8,7 @@ module ActiveModel
|
|||
#
|
||||
# user = User.first
|
||||
# user.pets.select(:id).first.user_id
|
||||
# # => ActiveModel::MissingAttributeError: missing attribute: user_id
|
||||
# # => ActiveModel::MissingAttributeError: missing attribute: user_id
|
||||
class MissingAttributeError < NoMethodError
|
||||
end
|
||||
# == Active \Model Attribute Methods
|
||||
|
@ -202,7 +202,7 @@ module ActiveModel
|
|||
# person.name # => "Bob"
|
||||
# person.nickname # => "Bob"
|
||||
# person.name_short? # => true
|
||||
# person.nickname_short? # => true
|
||||
# person.nickname_short? # => true
|
||||
def alias_attribute(new_name, old_name)
|
||||
self.attribute_aliases = attribute_aliases.merge(new_name.to_s => old_name.to_s)
|
||||
attribute_method_matchers.each do |matcher|
|
||||
|
|
|
@ -56,8 +56,8 @@ module ActiveModel
|
|||
# end
|
||||
#
|
||||
# BlogPost.model_name <=> 'BlogPost' # => 0
|
||||
# BlogPost.model_name <=> 'Blog' # => 1
|
||||
# BlogPost.model_name <=> 'BlogPosts' # => -1
|
||||
# BlogPost.model_name <=> 'Blog' # => 1
|
||||
# BlogPost.model_name <=> 'BlogPosts' # => -1
|
||||
|
||||
##
|
||||
# :method: =~
|
||||
|
|
|
@ -49,7 +49,7 @@ module ActiveModel
|
|||
# end
|
||||
#
|
||||
# ORM.observers = :cacher, :garbage_collector
|
||||
# ORM.observers # => [:cacher, :garbage_collector]
|
||||
# ORM.observers # => [:cacher, :garbage_collector]
|
||||
# ORM.observers.class # => ActiveModel::ObserverArray
|
||||
def observers
|
||||
@observers ||= ObserverArray.new(self)
|
||||
|
@ -328,8 +328,8 @@ module ActiveModel
|
|||
# Returns the class observed by default. It's inferred from the observer's
|
||||
# class name.
|
||||
#
|
||||
# PersonObserver.observed_class # => Person
|
||||
# AccountObserver.observed_class # => Account
|
||||
# PersonObserver.observed_class # => Person
|
||||
# AccountObserver.observed_class # => Account
|
||||
def observed_class
|
||||
name[/(.*)Observer/, 1].try :constantize
|
||||
end
|
||||
|
|
|
@ -85,8 +85,8 @@ module ActiveModel
|
|||
# person = Person.new
|
||||
# person.name = ''
|
||||
# person.valid? # => false
|
||||
# person.status # => false
|
||||
# person.name = 'bob'
|
||||
# person.status # => false
|
||||
# person.name = 'bob'
|
||||
# person.valid? # => true
|
||||
# person.status # => true
|
||||
def after_validation(*args, &block)
|
||||
|
|
Loading…
Reference in a new issue