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
99
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
56
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
180
[Wheel Lab #2] Apple Service with Rails.
hechien
0
92
[Sokoos][教育訓練] Git - 1
hechien
0
160
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
130
[作業] 創意美學
hechien
0
70
[教育訓練] Rails Form Basic
hechien
1
87
Rails Layout Basic
hechien
2
130
Other Decks in Technology
See All in Technology
ゴールデンパスは敷いただけでは道にならない ─ 企画部門のエンジニアが技術標準を事業価値に変えるまで
mhrtech
1
260
AI_Dev_Day_製造業領域でのAI活用から見た活用の罠と成功に導く実践知.pdf
kintotechdev
0
160
Aurora MySQL 8.4リリース! Rubyistが備えること / what-rubyist-should-prepare-for-aurora-mysql-8-4
fkmy
0
630
OpenTelemetryにおけるGoのゼロコード・コンパイル時計装について #fukuokago
quiver
0
200
AI、CDK と協働する Full TypeScript アプリケーション開発 / Full TypeScript Application with AI and CDK
geekplus_tech
2
480
穢れた技術選定について
watany
19
6.1k
VPCセキュリティ対応の最新事情
nagisa53
1
240
OPENLOGI Company Profile for engineer
hr01
1
74k
AI Coding Agent時代のcdk-nagガードレール 〜組織ルールを強制CIで守り抜く設計の挑戦〜
mhrtech
3
510
reFACToring
moznion
0
170
Amazon Quick 入門!
ysuzuki
2
130
第67回コンピュータビジョン勉強会CVPR2026読会前編
tsukamotokenji
0
160
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Fireside Chat
paigeccino
42
4k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
450
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
Writing Fast Ruby
sferik
630
63k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Into the Great Unknown - MozCon
thekraken
41
2.6k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
180
Test your architecture with Archunit
thirion
1
2.3k
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