aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/active_record_validations_callbacks.textile
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2011-10-07 22:20:29 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2011-10-07 22:20:29 +0530
commit4930f9d2a76c0b4a8f60efa72ade0b9cce3520b6 (patch)
treef1ed80653c6bcb3d89527e71f50b67799b6e4bd9 /railties/guides/source/active_record_validations_callbacks.textile
parent9312d217d6233710b291dab2d4edde483109e136 (diff)
parentcb244f4f70dbc22813e78e58f6a63392462417f7 (diff)
downloadrails-4930f9d2a76c0b4a8f60efa72ade0b9cce3520b6.tar.gz
rails-4930f9d2a76c0b4a8f60efa72ade0b9cce3520b6.tar.bz2
rails-4930f9d2a76c0b4a8f60efa72ade0b9cce3520b6.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'railties/guides/source/active_record_validations_callbacks.textile')
-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 2a1e9bfc0c..781b9001b6 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.