Skip to content

Commit 0275586

Browse files
committed
Site updated @ Tue Mar 24 15:31:10 CST 2015
1 parent e3e0362 commit 0275586

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

active_record_validations.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ <h1><a href="index.html" title="回首页">Guides.rubyonrails.org</a></h1>
173173
<h2>Active Record 数据验证</h2><p>本文介绍如何使用 Active Record 提供的数据验证功能在数据存入数据库之前验证对象的状态。</p><p>读完本文,你将学到:</p>
174174
<ul>
175175
<li>如何使用 Active Record 内建的数据验证帮助方法;</li>
176-
<li>如果编写自定义的数据验证方法</li>
176+
<li>如何编写自定义的数据验证方法</li>
177177
<li>如何处理验证时产生的错误消息;</li>
178178
</ul>
179179

@@ -403,7 +403,7 @@ <h4 id="valid-questionmark-和-invalid-questionmark">1.4 <code>valid?</code> 和
403403
</pre>
404404
</div>
405405
<h4 id="validates_associated">2.2 <code>validates_associated</code>
406-
</h4><p>如果模型和其他模型有关联,也要验证关联的模型对象,可以使用这个方法。保存对象是,会在相关联的每个对象上调用 <code>valid?</code> 方法。</p><div class="code_container">
406+
</h4><p>如果模型和其他模型有关联,也要验证关联的模型对象,可以使用这个方法。保存对象时,会在相关联的每个对象上调用 <code>valid?</code> 方法。</p><div class="code_container">
407407
<pre class="brush: ruby; gutter: false; toolbar: false">
408408
class Library &lt; ActiveRecord::Base
409409
has_many :books
@@ -791,7 +791,7 @@ <h4 id="条件组合">5.4 条件组合</h4><p>有时同一个条件会用在多
791791

792792
</pre>
793793
</div>
794-
<p><code>with_options</code> 代码块中的所有验证都会使用 <code>if: :is_admin?</code> 这个条件。</p><h4 id="联合条件">5.5 联合条件</h4><p>另一方面,如果是否做某个验证要满足多个条件时,可以使用数组。而且,都一个验证可以同时指定 <code>:if</code><code>:unless</code> 选项。</p><div class="code_container">
794+
<p><code>with_options</code> 代码块中的所有验证都会使用 <code>if: :is_admin?</code> 这个条件。</p><h4 id="联合条件">5.5 联合条件</h4><p>另一方面,当多个条件规定验证是否应该执行时,可以使用数组。而且,同一个验证可以同时指定 <code>:if</code><code>:unless</code> 选项。</p><div class="code_container">
795795
<pre class="brush: ruby; gutter: false; toolbar: false">
796796
class Computer &lt; ActiveRecord::Base
797797
validates :mouse, presence: true,

credits.html

+16-16
Original file line numberDiff line numberDiff line change
@@ -188,56 +188,56 @@ <h2>致谢</h2>
188188

189189
<h3 class="section">Rails 指南审阅者</h3>
190190

191-
<div class="clearfix" id="vijaydev"><img src="images/vijaydev.jpg" class="left pic" alt="Vijay Dev" width="91" height="91" /><h3>Vijay Dev</h3><p>
191+
<div class="clearfix" id="vijaydev"><img alt="Vijay Dev" class="left pic" height="91" src="images/vijaydev.jpg" width="91" /><h3>Vijay Dev</h3><p>
192192
Vijayakumar, found as Vijay Dev on the web, is a web applications developer and an open source enthusiast who lives in Chennai, India. He started using Rails in 2009 and began actively contributing to Rails documentation in late 2010. He <a href="https://twitter.com/vijay_dev">tweets</a> a lot and also <a href="http://vijaydev.wordpress.com">blogs</a>.
193193
</p></div>
194-
<div class="clearfix" id="fxn"><img src="images/fxn.png" class="left pic" alt="Xavier Noria" width="91" height="91" /><h3>Xavier Noria</h3><p>
194+
<div class="clearfix" id="fxn"><img alt="Xavier Noria" class="left pic" height="91" src="images/fxn.png" width="91" /><h3>Xavier Noria</h3><p>
195195
Xavier Noria has been into Ruby on Rails since 2005. He is a Rails core team member and enjoys combining his passion for Rails and his past life as a proofreader of math textbooks. Xavier is currently an independent Ruby on Rails consultant. Oh, he also <a href="http://twitter.com/fxn">tweets</a> and can be found everywhere as &quot;fxn&quot;.
196196
</p></div>
197197
<h3 class="section">Rails 指南设计师</h3>
198198

199-
<div class="clearfix" id="jz"><img src="images/credits_pic_blank.gif" class="left pic" alt="Jason Zimdars" width="91" height="91" /><h3>Jason Zimdars</h3><p>
199+
<div class="clearfix" id="jz"><img alt="Jason Zimdars" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Jason Zimdars</h3><p>
200200
Jason Zimdars is an experienced creative director and web designer who has lead UI and UX design for numerous websites and web applications. You can see more of his design and writing at <a href="http://www.thinkcage.com/">Thinkcage.com</a> or follow him on <a href="http://twitter.com/JZ">Twitter</a>.
201201
</p></div>
202202
<h3 class="section">Rails 指南作者群</h3>
203203

204-
<div class="clearfix" id="radar"><img src="images/radar.png" class="left pic" alt="Ryan Bigg" width="91" height="91" /><h3>Ryan Bigg</h3><p>
204+
<div class="clearfix" id="radar"><img alt="Ryan Bigg" class="left pic" height="91" src="images/radar.png" width="91" /><h3>Ryan Bigg</h3><p>
205205
Ryan Bigg works as the Community Manager at <a href="http://spreecommerce.com">Spree Commerce</a> and has been working with Rails since 2006. He's the author of <a href="https://leanpub.com/multi-tenancy-rails">Multi Tenancy With Rails</a> and co-author of <a href="http://manning.com/bigg2">Rails 4 in Action</a>. He's written many gems which can be seen on <a href="https://github.com/radar">his GitHub page</a> and he also tweets prolifically as <a href="http://twitter.com/ryanbigg">@ryanbigg</a>.
206206
</p></div>
207-
<div class="clearfix" id="oscardelben"><img src="images/oscardelben.jpg" class="left pic" alt="Oscar Del Ben" width="91" height="91" /><h3>Oscar Del Ben</h3><p>
207+
<div class="clearfix" id="oscardelben"><img alt="Oscar Del Ben" class="left pic" height="91" src="images/oscardelben.jpg" width="91" /><h3>Oscar Del Ben</h3><p>
208208
Oscar Del Ben is a software engineer at <a href="http://www.wildfireapp.com/">Wildfire</a>. He's a regular open source contributor (<a href="https://github.com/oscardelben">GitHub account</a>) and tweets regularly at <a href="https://twitter.com/oscardelben">@oscardelben</a>.
209209
</p></div>
210-
<div class="clearfix" id="fcheung"><img src="images/credits_pic_blank.gif" class="left pic" alt="Frederick Cheung" width="91" height="91" /><h3>Frederick Cheung</h3><p>
210+
<div class="clearfix" id="fcheung"><img alt="Frederick Cheung" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Frederick Cheung</h3><p>
211211
Frederick Cheung is Chief Wizard at Texperts where he has been using Rails since 2006. He is based in Cambridge (UK) and when not consuming fine ales he blogs at <a href="http://www.spacevatican.org">spacevatican.org</a>.
212212
</p></div>
213-
<div class="clearfix" id="toretore"><img src="images/credits_pic_blank.gif" class="left pic" alt="Tore Darell" width="91" height="91" /><h3>Tore Darell</h3><p>
213+
<div class="clearfix" id="toretore"><img alt="Tore Darell" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Tore Darell</h3><p>
214214
Tore Darell is an independent developer based in Menton, France who specialises in cruft-free web applications using Ruby, Rails and unobtrusive JavaScript. His home on the Internet is his blog <a href="http://tore.darell.no">Sneaky Abstractions</a>.
215215
</p></div>
216-
<div class="clearfix" id="zilkey"><img src="images/credits_pic_blank.gif" class="left pic" alt="Jeff Dean" width="91" height="91" /><h3>Jeff Dean</h3><p>
216+
<div class="clearfix" id="zilkey"><img alt="Jeff Dean" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Jeff Dean</h3><p>
217217
Jeff Dean is a software engineer with <a href="http://pivotallabs.com">Pivotal Labs</a>.
218218
</p></div>
219-
<div class="clearfix" id="mgunderloy"><img src="images/credits_pic_blank.gif" class="left pic" alt="Mike Gunderloy" width="91" height="91" /><h3>Mike Gunderloy</h3><p>
219+
<div class="clearfix" id="mgunderloy"><img alt="Mike Gunderloy" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Mike Gunderloy</h3><p>
220220
Mike Gunderloy is a consultant with <a href="http://www.actionrails.com">ActionRails</a>. He brings 25 years of experience in a variety of languages to bear on his current work with Rails. His near-daily links and other blogging can be found at <a href="http://afreshcup.com">A Fresh Cup</a> and he <a href="http://twitter.com/MikeG1">twitters</a> too much.
221221
</p></div>
222-
<div class="clearfix" id="raasdnil"><img src="images/credits_pic_blank.gif" class="left pic" alt="Mikel Lindsaar" width="91" height="91" /><h3>Mikel Lindsaar</h3><p>
222+
<div class="clearfix" id="raasdnil"><img alt="Mikel Lindsaar" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Mikel Lindsaar</h3><p>
223223
Mikel Lindsaar has been working with Rails since 2006 and is the author of the Ruby <a href="https://github.com/mikel/mail">Mail gem</a> and core contributor (he helped re-write Action Mailer's API). Mikel is the founder of <a href="http://rubyx.com/">RubyX</a>, has a <a href="http://lindsaar.net/">blog</a> and <a href="http://twitter.com/raasdnil">tweets</a>.
224224
</p></div>
225-
<div class="clearfix" id="cmarques"><img src="images/credits_pic_blank.gif" class="left pic" alt="Cássio Marques" width="91" height="91" /><h3>Cássio Marques</h3><p>
225+
<div class="clearfix" id="cmarques"><img alt="Cássio Marques" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Cássio Marques</h3><p>
226226
Cássio Marques is a Brazilian software developer working with different programming languages such as Ruby, JavaScript, CPP and Java, as an independent consultant. He blogs at <a href="http://cassiomarques.wordpress.com">/* CODIFICANDO */</a>, which is mainly written in Portuguese, but will soon get a new section for posts with English translation.
227227
</p></div>
228-
<div class="clearfix" id="bensie"><img src="images/credits_pic_blank.gif" class="left pic" alt="James Miller" width="91" height="91" /><h3>James Miller</h3><p>
228+
<div class="clearfix" id="bensie"><img alt="James Miller" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>James Miller</h3><p>
229229
James Miller is a software developer for <a href="http://www.jk-tech.com">JK Tech</a> in San Diego, CA. You can find James on GitHub, Gmail, Twitter, and Freenode as &quot;bensie&quot;.
230230
</p></div>
231-
<div class="clearfix" id="lifo"><img src="images/credits_pic_blank.gif" class="left pic" alt="Pratik Naik" width="91" height="91" /><h3>Pratik Naik</h3><p>
231+
<div class="clearfix" id="lifo"><img alt="Pratik Naik" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Pratik Naik</h3><p>
232232
Pratik Naik is a Ruby on Rails developer at <a href="https://basecamp.com/">Basecamp</a> and also a member of the <a href="http://rubyonrails.org/core">Rails core team</a>. He maintains a blog at <a href="http://m.onkey.org">has_many :bugs, :through =&gt; :rails</a> and has a semi-active <a href="http://twitter.com/lifo">twitter account</a>.
233233
</p></div>
234-
<div class="clearfix" id="miloops"><img src="images/credits_pic_blank.gif" class="left pic" alt="Emilio Tagua" width="91" height="91" /><h3>Emilio Tagua</h3><p>
234+
<div class="clearfix" id="miloops"><img alt="Emilio Tagua" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Emilio Tagua</h3><p>
235235
Emilio Tagua &mdash;a.k.a. miloops&mdash; is an Argentinian entrepreneur, developer, open source contributor and Rails evangelist. Cofounder of <a href="http://eventioz.com">Eventioz</a>. He has been using Rails since 2006 and contributing since early 2008. Can be found at gmail, twitter, freenode, everywhere as &quot;miloops&quot;.
236236
</p></div>
237-
<div class="clearfix" id="hawe"><img src="images/credits_pic_blank.gif" class="left pic" alt="Heiko Webers" width="91" height="91" /><h3>Heiko Webers</h3><p>
237+
<div class="clearfix" id="hawe"><img alt="Heiko Webers" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Heiko Webers</h3><p>
238238
Heiko Webers is the founder of <a href="http://www.bauland42.de">bauland42</a>, a German web application security consulting and development company focused on Ruby on Rails. He blogs at the <a href="http://www.rorsecurity.info">Ruby on Rails Security Project</a>. After 10 years of desktop application development, Heiko has rarely looked back.
239239
</p></div>
240-
<div class="clearfix" id="startupjockey"><img src="images/akshaysurve.jpg" class="left pic" alt="Akshay Surve" width="91" height="91" /><h3>Akshay Surve</h3><p>
240+
<div class="clearfix" id="startupjockey"><img alt="Akshay Surve" class="left pic" height="91" src="images/akshaysurve.jpg" width="91" /><h3>Akshay Surve</h3><p>
241241
Akshay Surve is the Founder at <a href="http://www.deltax.com">DeltaX</a>, hackathon specialist, a midnight code junkie and occasionally writes prose. You can connect with him on <a href="https://twitter.com/akshaysurve">Twitter</a>, <a href="http://www.linkedin.com/in/akshaysurve">Linkedin</a>, <a href="http://www.akshaysurve.com/">Personal Blog</a> or <a href="http://www.quora.com/Akshay-Surve">Quora</a>.
242242
</p></div>
243243

0 commit comments

Comments
 (0)