5
A
回答
3
我可以提供2種選擇:
第一:
validates_presence_of :sex, :name, :surname, if: -> { state == 'personal' }
第二
event :fill_personal do
before do
instance_eval do
validates_presence_of :sex, :name, :surname
end
end
transitions from: :empty, to: :personal
end
相關問題
- 1. AASM:驗證其對象從<a href="http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk" rel="nofollow noreferrer">http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk</a></p> <p>向前
- 2. 將令牌添加到<a href
- 3. 從<a href="http://projecteuler.net/" rel="nofollow">http://projecteuler.net/</a>在Python
- 4. RDFLib:使用<a href="http://www.rdflib.net/" rel="nofollow">RDFLib 3.0</a>
- 5. 如何添加默認的AASM狀態到現有的模型
- 6. 驗證失敗 - 999- HTTP狀態代碼不被處理或者使用我不<a href="http://scrapy.org/" rel="nofollow">scrapy</a>允許
- 7. 如何使用jQuery將rel添加到<a>標記?
- 8. 上<a href="http://php.net/manual/en/class.httprequest.php" rel="nofollow">HttpRequest</a>在Ubuntu
- 9. 生成路徑上<a href="http://rapgenius.com" rel="nofollow noreferrer">Rap Genius</a>
- 10. 對上<a href="http://beta.ovoweb.net/" rel="noreferrer">http://beta.ovoweb.net/</a>對齊鏈接
- 11. 如何使用<a href="http://cocoapods.org/" rel="nofollow">CocoaPods</a>使用的CocoaPods
- 12. 如何 <a href="http://developer.palm.com/index.php?opt" rel="nofollow noreferrer">http://developer.palm.com/index.php?opt</a>
- 13. 動態添加上<a>
- 14. @ Html.ActionLink到<a href="@Url.Action()>
- 15. Preg_match_all <a href
- 16. 將URL添加到<a href=""> with Emmet
- 17. 將網址添加到<a href="value">
- 18. 添加JavaScript得到函數A HREF
- 19. jQuery click()將href添加到a-tag
- 20. Ruby使用AASM添加動態事件
- 21. 解析服務器user.getSessionToken()上<a href="https://parse.com/docs/js/api/classes/Parse.User.html#methods_getSessionToken" rel="nofollow"><code>Parse.User.getSessionToken</code></a>狀態沒有定義
- 22. 關於php的動態鏈接<a href=""></a>
- 23. jQuery的表單驗證不包括<a href="http://www.runningcoder.org/jqueryvalidation/" rel="nofollow noreferrer">http://www.runningcoder.org/jqueryvalidation/</a></p> <p>demo.html提交按鈕
- 24. 無法從這裏<a href="http://webcheatsheet.com/javascript/form_validation.php" rel="nofollow">http://webcheatsheet.com/javascript/form_validation.php</a></p> <p>找出與JavaScript表單驗證
- 25. <a href=...> syntax
- 26. <a href="#!"> do?
- 27. <a href="link.html">
- 28. 替換類<a></a>基於狀態
- 29. 如何在現有的<a href=""></a>上添加target =「_ blank」?
- 30. <a href=""></a>不工作