diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-06-08 04:48:03 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-06-08 04:48:42 +0530 |
commit | 7fd8f71ce0b8e0bf30b416d5b6425bb5b636ed76 (patch) | |
tree | e9520f8395c9302d28fe4d2881b4e4ab5072a3fb /railties/guides | |
parent | f8cfa7afdba2c14eec5a2a25f7c63050441e2a90 (diff) | |
download | rails-7fd8f71ce0b8e0bf30b416d5b6425bb5b636ed76.tar.gz rails-7fd8f71ce0b8e0bf30b416d5b6425bb5b636ed76.tar.bz2 rails-7fd8f71ce0b8e0bf30b416d5b6425bb5b636ed76.zip |
fix incorrect validation examples
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/active_record_validations_callbacks.textile | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 36094dcddc..50ff1c9ff7 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -182,7 +182,7 @@ It can receive an +:accept+ option, which determines the value that will be cons <ruby> class Person < ActiveRecord::Base - validates :terms_of_service, :acceptance => true, :accept => 'yes' + validates :terms_of_service, :acceptance => { :accept => 'yes' } end </ruby> @@ -338,7 +338,7 @@ WARNING. Note that the regular expression above allows a trailing newline charac <ruby> class Player < ActiveRecord::Base validates :points, :numericality => true - validates :games_played, :numericality => true, :only_integer => true + validates :games_played, :numericality => { :only_integer => true } end </ruby> @@ -393,8 +393,8 @@ There is a +:scope+ option that you can use to specify other attributes that are <ruby> class Holiday < ActiveRecord::Base - validates :name, :uniqueness => true, :scope => :year, - :message => "should happen once per year" + validates :name, :uniqueness => { :scope => :year, + :message => "should happen once per year" } end </ruby> @@ -402,7 +402,7 @@ There is also a +:case_sensitive+ option that you can use to define whether the <ruby> class Person < ActiveRecord::Base - validates :name, :uniqueness => true, :case_sensitive => false + validates :name, :uniqueness => { :case_sensitive => false } end </ruby> |