Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[教育訓練] Rails Validation Basic
Search
HeChien Hsu
September 04, 2012
Technology
89
1
Share
[教育訓練] Rails Validation Basic
HeChien Hsu
September 04, 2012
More Decks by HeChien Hsu
See All by HeChien Hsu
Using Git hosting
hechien
0
49
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
170
[Wheel Lab #2] Apple Service with Rails.
hechien
0
88
[Sokoos][教育訓練] Git - 1
hechien
0
160
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
120
[作業] 創意美學
hechien
0
62
[教育訓練] Rails Form Basic
hechien
1
79
Rails Layout Basic
hechien
2
130
Other Decks in Technology
See All in Technology
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
470
スクラムの中で AI-DLC workflow を 使い始めて3ヶ月の振り返り
kaminashi
0
120
AI バイブコーティングでキーボード不要?!
samakada
0
600
データ定義の混乱と戦う 〜 管理会計と財務会計 〜
wonohe
0
140
20260428_Product Management Summit_Loglass_JoeHirose
loglassjoe
2
3.6k
Do Vibe Coding ao LLM em Produção para Busca Agêntica - TDC 2026 - Summit IA - São Paulo
jpbonson
3
150
Keeping Ruby Running on Cygwin
fd0
0
170
20260423_執筆の工夫と裏側 技術書の企画から刊行まで / From the planning to the publication of technical book
nash_efp
3
430
Practical TypeProf: Lessons from Analyzing Optcarrot
mame
0
940
Chasing Real-Time Observability for CRuby
whitegreen
0
200
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
280
クラウドネイティブな開発 ~ 認知負荷に立ち向かうためのコンテナ活用
literalice
0
150
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Six Lessons from altMBA
skipperchong
29
4.2k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
110
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
520
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
Faster Mobile Websites
deanohume
310
31k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Mind Mapping
helmedeiros
PRO
1
160
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Transcript
Rails Validation 徐赫謙
Rails Validation Basic
會經過驗證的 • create • create! • save • save! •
update • update_attributes • update_attributes!
注意 • 有驚嘆號的(save!)驗證失敗會丟例外 • 沒驚嘆號的驗證失敗會回傳 • false: save, update_attributes •
物件: create, update
不會經過驗證的 decrement! • decrement_counter • increment! • increment_counter • toggle!
• touch • update_all • update_attribute • update_column • update_counters
⼿手動跟驗證說掰掰 save({validate: false})
Demo https://gist.github.com/3508269#file_02_demo.rb
valid? invalid? https://gist.github.com/3508269#file_01_valid_invalid.rb
errors[] https://gist.github.com/3508269#file_01_valid_invalid.rb
helpers • acceptance • confirmation • exclusion • format •
uniqueness • inclusion • length • numericality • presence • size • validates_associated
Example https://gist.github.com/3508269#file_04_demo.rb