diff options
author | CassioMarques <cassiommc@gmail.com> | 2008-11-04 22:24:29 -0200 |
---|---|---|
committer | CassioMarques <cassiommc@gmail.com> | 2008-11-04 22:35:41 -0200 |
commit | 746fed22ff5aebe372f55c083bbf0682d02e0381 (patch) | |
tree | f25af99d5d58956813e2f406ae1635bace49be89 /railties/doc | |
parent | 6eb128fde3b1ce459e7ad44c8e34d588ef6cd3ec (diff) | |
download | rails-746fed22ff5aebe372f55c083bbf0682d02e0381.tar.gz rails-746fed22ff5aebe372f55c083bbf0682d02e0381.tar.bz2 rails-746fed22ff5aebe372f55c083bbf0682d02e0381.zip |
Initial commit for Active Record validations and callbacks guide
Diffstat (limited to 'railties/doc')
3 files changed, 300 insertions, 2 deletions
diff --git a/railties/doc/guides/html/activerecord_validations_callbacks.html b/railties/doc/guides/html/activerecord_validations_callbacks.html new file mode 100644 index 0000000000..c9128a8533 --- /dev/null +++ b/railties/doc/guides/html/activerecord_validations_callbacks.html @@ -0,0 +1,267 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>Active Record Validations and Callbacks</title> + <!--[if lt IE 8]> + <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script> + <![endif]--> + <link href="stylesheets/base.css" media="screen" rel="Stylesheet" type="text/css" /> + <link href="stylesheets/forms.css" media="screen" rel="Stylesheet" type="text/css" /> + <link href="stylesheets/more.css" media="screen" rel="Stylesheet" type="text/css" /> + <style type="text/css"> + div#container { + max-width: 900px; + padding-bottom: 3em; +} + +div#content { + margin-left: 200px; +} + +div#container.notoc { + max-width: 600px; +} + +.notoc div#content { + margin-left: 0; +} + +pre { + line-height: 1.4em; +} + +#content p tt { + background: #eeeeee; + border: solid 1px #cccccc; + padding: 3px; +} + +dt { + font-weight: bold; +} + +#content dt tt { + font-size: 10pt; +} + +dd { + margin-left: 3em; +} + +#content dt tt, #content pre tt { + background: none; + padding: 0; + border: 0; +} + +#content .olist ol { + margin-left: 2em; +} + +#header { + position: relative; + max-width: 840px; + margin-left: auto; + margin-right: auto; +} + +#header.notoc { + max-width: 580px; +} + +#logo { + position: absolute; + left: 10px; + top: 10px; + width: 110px; + height: 140px; +} + +div#header h1#site_title { + background: url('images/ruby_on_rails_by_mike_rundle2.gif') top left no-repeat; + position: absolute; + width: 392px; + height: 55px; + left: 145px; + top: 20px; + margin: 0; + padding: 0; +} + +#site_title span { + display: none; +} + +#site_title_tagline { + display: none; +} + +ul#navMain { + position: absolute; + margin: 0; + padding: 0; + top: 97px; + left: 145px; +} + +.left-floaty, .right-floaty { + padding: 15px; +} + +.admonitionblock, +.tableblock { + margin-left: 1em; + margin-right: 1em; + margin-top: 0.25em; + margin-bottom: 1em; +} + +.admonitionblock .icon { + padding-right: 8px; +} + +.admonitionblock .content { + border: solid 1px #ffda78; + background: #fffebd; + padding: 10px; + padding-top: 8px; + padding-bottom: 8px; +} + +.admonitionblock .title { + font-size: 140%; + margin-bottom: 0.5em; +} + +.tableblock table { + border: solid 1px #aaaaff; + background: #f0f0ff; +} + +.tableblock th { + background: #e0e0e0; +} + +.tableblock th, +.tableblock td { + padding: 3px; + padding-left: 5px; + padding-right: 5px; +} + +.sidebarblock { + margin-top: 0.25em; + margin: 1em; + border: solid 1px #ccccbb; + padding: 8px; + background: #ffffe0; +} + +.sidebarblock .sidebar-title { + font-size: 140%; + font-weight: 600; + margin-bottom: 0.3em; +} + +.sidebarblock .sidebar-content > .para:last-child > p { + margin-bottom: 0; +} + +.sidebarblock .sidebar-title a { + text-decoration: none; +} + +.sidebarblock .sidebar-title a:hover { + text-decoration: underline; +} + + </style> +</head> +<body> + <div id="header" > + <div id="logo"> + <a href="index.html" title="Ruby on Rails"><img src="images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a> + </div> + + <h1 id="site_title"><span>Ruby on Rails</span></h1> + <h2 id="site_title_tagline">Sustainable productivity for web-application development</h2> + + <ul id="navMain"> + <li class="first-child"><a href="http://www.rubyonrails.org/" title="Ruby on Rails" class="ruby_on_rails">Ruby on Rails</a></li> + <li><a class="manuals" href="index.html" title="Manuals Index">Guides Index</a></li> + </ul> + </div> + + <div id="container"> + + <div id="sidebar"> + <h2>Chapters</h2> + <ol> + <li> + <a href="#_active_record_validations">Active Record Validations</a> + </li> + <li> + <a href="#_credits">Credits</a> + </li> + <li> + <a href="#_changelog">Changelog</a> + </li> + </ol> + </div> + + <div id="content"> + <h1>Active Record Validations and Callbacks</h1> + <div id="preamble">
+<div class="sectionbody">
+<div class="para"><p>This guide teaches you how to work with the lifecycle of your Active Record objects. More precisely, you will learn how to validate the state of your objects before they go into the database and also how to teach them to perform custom operations at certain points of their lifecycles.</p></div>
+<div class="para"><p>After reading this guide and trying out the presented concepts, we hope that you'll be able to:</p></div>
+<div class="ilist"><ul>
+<li>
+<p>
+Correctly use all the built-in Active Record validation helpers
+</p>
+</li>
+<li>
+<p>
+Create your own custom validation methods
+</p>
+</li>
+<li>
+<p>
+Work with the error messages generated by the validation proccess
+</p>
+</li>
+<li>
+<p>
+Register callback methods that will execute custom operations during your objects lifecycle, for example before/after they are saved.
+</p>
+</li>
+<li>
+<p>
+Create special classes that encapsulate common behaviour for your callbacks
+</p>
+</li>
+<li>
+<p>
+Create Observers - classes with callback methods specific for each of your models, keeping the callback code outside your models' declarations.
+</p>
+</li>
+</ul></div>
+</div>
+</div>
+<h2 id="_active_record_validations">1. Active Record Validations</h2>
+<div class="sectionbody">
+</div>
+<h2 id="_credits">2. Credits</h2>
+<div class="sectionbody">
+</div>
+<h2 id="_changelog">3. Changelog</h2>
+<div class="sectionbody">
+<div class="para"><p><a href="http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks">http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks</a></p></div>
+</div>
+ + </div> + </div> +</body> +</html> diff --git a/railties/doc/guides/html/index.html b/railties/doc/guides/html/index.html index 84618d95e2..f8d14ffdd5 100644 --- a/railties/doc/guides/html/index.html +++ b/railties/doc/guides/html/index.html @@ -179,7 +179,7 @@ ul#navMain { </style> </head> <body> - <div id="header" class="notoc"> + <div id="header" > <div id="logo"> <a href="index.html" title="Ruby on Rails"><img src="images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a> </div> @@ -193,7 +193,13 @@ ul#navMain { </ul> </div> - <div id="container" class="notoc"> + <div id="container"> + + <div id="sidebar"> + <h2>Chapters</h2> + <ol> + </ol> + </div> <div id="content"> <h1>Ruby on Rails guides</h1> diff --git a/railties/doc/guides/source/activerecord_validations_callbacks.txt b/railties/doc/guides/source/activerecord_validations_callbacks.txt new file mode 100644 index 0000000000..cd698d0c1e --- /dev/null +++ b/railties/doc/guides/source/activerecord_validations_callbacks.txt @@ -0,0 +1,25 @@ +Active Record Validations and Callbacks +======================================= + +This guide teaches you how to work with the lifecycle of your Active Record objects. More precisely, you will learn how to validate the state of your objects before they go into the database and also how to teach them to perform custom operations at certain points of their lifecycles. + +After reading this guide and trying out the presented concepts, we hope that you'll be able to: + +* Correctly use all the built-in Active Record validation helpers +* Create your own custom validation methods +* Work with the error messages generated by the validation proccess +* Register callback methods that will execute custom operations during your objects lifecycle, for example before/after they are saved. +* Create special classes that encapsulate common behaviour for your callbacks +* Create Observers - classes with callback methods specific for each of your models, keeping the callback code outside your models' declarations. + +== Active Record Validations + + + +== Credits + + + +== Changelog + +http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks |