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
81
[教育訓練] 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
160
[Wheel Lab #2] Apple Service with Rails.
hechien
0
78
[Sokoos][教育訓練] Git - 1
hechien
0
150
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
110
[作業] 創意美學
hechien
0
56
[教育訓練] Rails Form Basic
hechien
1
73
Rails Layout Basic
hechien
2
120
Other Decks in Technology
See All in Technology
AWS IoT 超入門 2025
hattori
0
290
extension 現場で使えるXcodeショートカット一覧
ktombow
0
220
衛星画像超解像化によって実現する2D, 3D空間情報の即時生成と“AI as a Service”/ Real-time generation spatial data enabled_by satellite image super-resolution
lehupa
0
140
OpenAI gpt-oss ファインチューニング入門
kmotohas
2
1.2k
Developer Advocate / Community Managerなるには?
tsho
0
120
AIAgentの限界を超え、 現場を動かすWorkflowAgentの設計と実践
miyatakoji
1
160
LLMアプリの地上戦開発計画と運用実践 / 2025.10.15 GPU UNITE 2025
smiyawaki0820
1
360
速習AGENTS.md:5分で精度を上げる "3ブロック" テンプレ
ismk
1
430
GoでもGUIアプリを作りたい!
kworkdev
PRO
0
120
後進育成のしくじり〜任せるスキルとリーダーシップの両立〜
matsu0228
7
3.2k
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
3
5.5k
これがLambdaレス時代のChatOpsだ!実例で学ぶAmazon Q Developerカスタムアクション活用法
iwamot
PRO
6
920
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
49
14k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
A Tale of Four Properties
chriscoyier
161
23k
The Cult of Friendly URLs
andyhume
79
6.6k
GitHub's CSS Performance
jonrohan
1032
470k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.3k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
Producing Creativity
orderedlist
PRO
347
40k
Designing for Performance
lara
610
69k
Visualization
eitanlees
149
16k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
54
3k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
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