Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[教育訓練] Rails Validation Basic
Search
HeChien Hsu
September 04, 2012
Technology
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[教育訓練] Rails Validation Basic
HeChien Hsu
September 04, 2012
More Decks by HeChien Hsu
See All by HeChien Hsu
Using Git hosting
hechien
0
66
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
200
[Wheel Lab #2] Apple Service with Rails.
hechien
0
110
[Sokoos][教育訓練] Git - 1
hechien
0
170
[數位教學] 用Bootstrap製作網頁
hechien
0
1.4k
DesignYou - 專題報告投影片
hechien
0
140
[作業] 創意美學
hechien
0
81
[教育訓練] Rails Form Basic
hechien
1
88
Rails Layout Basic
hechien
2
140
Other Decks in Technology
See All in Technology
AI Made Us Faster at Solving the Wrong Problems
marceloancelmo
0
190
Essential architectural thinking (revised edition)
ufried
0
110
初対面のメンバーがチームを組み、Claude Codeでゼロからサービスをリリース
mkdev10
1
110
freeeらしさをAIとともに作る / Creating the freee Experience with AI
ymrl
0
210
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
690
全人類(ほぼ)AWS Organizations の上でAWSを利用している、その世界を知る話
htan
1
130
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
0
130
転んだ話が背中を預ける理由になる / A_story_about_falling_down_gives_you_a_reason_to_watch_each_other_s_backs.pdf
pauli
3
330
FactoryBotアンチパターン / factory_bot anti-patterns
toshimaru
0
140
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
7
1.6k
検証フェーズはAIの回答を判断するための学習機会
toru_kubota
2
530
組み立てて楽しむ AWS Blocks 入門
kmiya84377
0
220
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
350
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
610
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Odyssey Design
rkendrick25
PRO
2
860
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
920
Believing is Seeing
oripsolob
1
240
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
4 Signs Your Business is Dying
shpigford
187
23k
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