aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorManuel Menezes de Sequeira <MMSequeira@gmail.com>2011-10-05 22:14:41 +0100
committerManuel Menezes de Sequeira <MMSequeira@gmail.com>2011-10-05 22:14:41 +0100
commit8d775d5f1d58e5c0d881383e8c6e869d1d360c8c (patch)
tree1fd00095816d27505e750ca72f65281f419599f6 /railties/guides
parent34ed93931dcf688bc4f0f8f5649a44f2f1118a6a (diff)
downloadrails-8d775d5f1d58e5c0d881383e8c6e869d1d360c8c.tar.gz
rails-8d775d5f1d58e5c0d881383e8c6e869d1d360c8c.tar.bz2
rails-8d775d5f1d58e5c0d881383e8c6e869d1d360c8c.zip
Correction of code snippet tag from shell to ruby.
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/source/active_record_validations_callbacks.textile4
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile
index 600681ddd3..9346a408e0 100644
--- a/railties/guides/source/active_record_validations_callbacks.textile
+++ b/railties/guides/source/active_record_validations_callbacks.textile
@@ -46,7 +46,7 @@ end
We can see how it works by looking at some +rails console+ output:
-<shell>
+<ruby>
>> p = Person.new(:name => "John Doe")
=> #<Person id: nil, name: "John Doe", created_at: nil, :updated_at: nil>
>> p.new_record?
@@ -55,7 +55,7 @@ We can see how it works by looking at some +rails console+ output:
=> true
>> p.new_record?
=> false
-</shell>
+</ruby>
Creating and saving a new record will send an SQL +INSERT+ operation to the database. Updating an existing record will send an SQL +UPDATE+ operation instead. Validations are typically run before these commands are sent to the database. If any validations fail, the object will be marked as invalid and Active Record will not perform the +INSERT+ or +UPDATE+ operation. This helps to avoid storing an invalid object in the database. You can choose to have specific validations run when an object is created, saved, or updated.