fix incorrect validation examples

Conflicts:

	railties/guides/source/active_record_validations_callbacks.textile
This commit is contained in:
Vijay Dev
2011-06-08 04:48:03 +05:30
committed by Xavier Noria
parent 3de9d6b0ff
commit 290708ce3d

View File

@@ -182,7 +182,7 @@ The default error message for +validates_acceptance_of+ is "_must be accepted_".
<ruby>
class Person < ActiveRecord::Base
validates_acceptance_of :terms_of_service, :accept => 'yes'
validates :terms_of_service, :acceptance => { :accept => 'yes' }
end
</ruby>
@@ -336,8 +336,13 @@ WARNING. Note that the regular expression above allows a trailing newline charac
<ruby>
class Player < ActiveRecord::Base
<<<<<<< HEAD
validates_numericality_of :points
validates_numericality_of :games_played, :only_integer => true
=======
validates :points, :numericality => true
validates :games_played, :numericality => { :only_integer => true }
>>>>>>> 7fd8f71... fix incorrect validation examples
end
</ruby>
@@ -392,8 +397,13 @@ There is a +:scope+ option that you can use to specify other attributes that are
<ruby>
class Holiday < ActiveRecord::Base
<<<<<<< HEAD
validates_uniqueness_of :name, :scope => :year,
:message => "should happen once per year"
=======
validates :name, :uniqueness => { :scope => :year,
:message => "should happen once per year" }
>>>>>>> 7fd8f71... fix incorrect validation examples
end
</ruby>
@@ -401,7 +411,11 @@ There is also a +:case_sensitive+ option that you can use to define whether the
<ruby>
class Person < ActiveRecord::Base
<<<<<<< HEAD
validates_uniqueness_of :name, :case_sensitive => false
=======
validates :name, :uniqueness => { :case_sensitive => false }
>>>>>>> 7fd8f71... fix incorrect validation examples
end
</ruby>