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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
HeChien Hsu
September 04, 2012
Technology
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[教育訓練] Rails Validation Basic
HeChien Hsu
September 04, 2012
Transcript
11 slides
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
More Decks by HeChien Hsu
See All by HeChien Hsu
Using Git hosting
hechien
0
67
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
220
[Wheel Lab #2] Apple Service with Rails.
hechien
0
130
[Sokoos][教育訓練] Git - 1
hechien
0
190
[數位教學] 用Bootstrap製作網頁
hechien
0
1.4k
DesignYou - 專題報告投影片
hechien
0
160
[作業] 創意美學
hechien
0
95
[教育訓練] Rails Form Basic
hechien
1
92
Rails Layout Basic
hechien
2
140
Other Decks in Technology
See All in Technology
AWS DevOps Agentの構造から読み解く運用 AI エージェントの設計原則/aws-devops-agent-design-principles
tomoki10
0
330
VTuberになってみた話
yoshimura_datam
0
140
40以上のマイクロサービスを支えるKubernetes JITアクセス — 160以上の恒久RoleBindingを削減
jumpe1
0
120
技術同人誌を作る方法
yoshimura_datam
0
120
20261119_AgentCore
takuyay0ne
2
360
AWS初心者のAIエンジニアが、 論文サーベイエージェントを AgentCoreで動かしてみた
dirard12
0
110
セキュリティチームは どのコンテナイメージの脆弱性対応を優先すべきか 〜CISA新指針とSCCで作る脆弱性トリアージ〜
swdtkuy
0
380
AWS re:Invent 2026 FSI Pre-Event Networking Night
junjikoide
0
400
技術書典で本を売る流れ
yoshimura_datam
0
210
生成AIによる情報システムへのインパクト (2026年11月版)
taka_aki
0
140
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
3
200
現場に渡し、構造で守る AI エージェントを活用したセルフサーブのデータ基盤の運用
legalontechnologies
PRO
0
190
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.5k
エンジニアに許された特別な時間の終わり
watany
109
250k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
630
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.5k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
570
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
540
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
870
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
1
320
Tell your own story through comics
letsgokoyo
1
1.1k