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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
HeChien Hsu
September 04, 2012
Technology
1
84
[教育訓練] 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
47
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
170
[Wheel Lab #2] Apple Service with Rails.
hechien
0
82
[Sokoos][教育訓練] Git - 1
hechien
0
150
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
120
[作業] 創意美學
hechien
0
60
[教育訓練] Rails Form Basic
hechien
1
76
Rails Layout Basic
hechien
2
120
Other Decks in Technology
See All in Technology
22nd ACRi Webinar - NTT Kawahara-san's slide
nao_sumikawa
0
100
2026年、サーバーレスの現在地 -「制約と戦う技術」から「当たり前の実行基盤」へ- /serverless2026
slsops
2
260
Digitization部 紹介資料
sansan33
PRO
1
6.8k
広告の効果検証を題材にした因果推論の精度検証について
zozotech
PRO
0
190
30万人の同時アクセスに耐えたい!新サービスの盤石なリリースを支える負荷試験 / SRE Kaigi 2026
genda
4
1.3k
We Built for Predictability; The Workloads Didn’t Care
stahnma
0
140
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
顧客の言葉を、そのまま信じない勇気
yamatai1212
1
360
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
220
StrandsとNeptuneを使ってナレッジグラフを構築する
yakumo
1
120
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
1
370
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
450
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
ラッコキーワード サービス紹介資料
rakko
1
2.3M
Docker and Python
trallard
47
3.7k
Odyssey Design
rkendrick25
PRO
1
500
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
110
Utilizing Notion as your number one productivity tool
mfonobong
3
220
We Have a Design System, Now What?
morganepeng
54
8k
Context Engineering - Making Every Token Count
addyosmani
9
660
Making the Leap to Tech Lead
cromwellryan
135
9.7k
We Are The Robots
honzajavorek
0
160
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
100
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