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
1
82
[教育訓練] Rails Validation Basic
HeChien Hsu
September 04, 2012
Tweet
Share
More Decks by HeChien Hsu
See All by HeChien Hsu
Using Git hosting
hechien
0
45
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
170
[Wheel Lab #2] Apple Service with Rails.
hechien
0
81
[Sokoos][教育訓練] Git - 1
hechien
0
150
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
110
[作業] 創意美學
hechien
0
60
[教育訓練] Rails Form Basic
hechien
1
75
Rails Layout Basic
hechien
2
120
Other Decks in Technology
See All in Technology
re:Invent2025 セッションレポ ~Spec-driven development with Kiro~
nrinetcom
PRO
2
170
Everything As Code
yosuke_ai
0
500
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.9k
RALGO : AIを組織に組み込む方法 -アルゴリズム中心組織設計- #RSGT2026 / RALGO: How to Integrate AI into an Organization – Algorithm-Centric Organizational Design
kyonmm
PRO
3
990
Java 25に至る道
skrb
3
200
AI時代のアジャイルチームを目指して ー スクラムというコンフォートゾーンからの脱却 ー / Toward Agile Teams in the Age of AI
takaking22
11
6k
チームで安全にClaude Codeを利用するためのプラクティス / team-claude-code-practices
tomoki10
6
3.1k
Digitization部 紹介資料
sansan33
PRO
1
6.5k
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
21k
AWSと生成AIで学ぶ!実行計画の読み解き方とSQLチューニングの実践
yakumo
2
340
「駆動」って言葉、なんかカッコイイ_Mitz
comucal
PRO
0
140
スクラムマスターが スクラムチームに入って取り組む5つのこと - スクラムガイドには書いてないけど入った当初から取り組んでおきたい大切なこと -
scrummasudar
2
1.9k
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
0
2.6k
Designing Powerful Visuals for Engaging Learning
tmiket
0
200
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
How to build a perfect <img>
jonoalderson
1
4.8k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
49
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Music & Morning Musume
bryan
46
7k
Agile that works and the tools we love
rasmusluckow
331
21k
Embracing the Ebb and Flow
colly
88
4.9k
We Have a Design System, Now What?
morganepeng
54
8k
Abbi's Birthday
coloredviolet
0
4.2k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
46
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