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
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
今日から始めるAmazon Bedrock AgentCore
har1101
4
410
【Ubie】AIを活用した広告アセット「爆速」生成事例 | AI_Ops_Community_Vol.2
yoshiki_0316
1
110
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
260
ランサムウェア対策としてのpnpm導入のススメ
ishikawa_satoru
0
180
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
160
顧客の言葉を、そのまま信じない勇気
yamatai1212
1
360
【Oracle Cloud ウェビナー】[Oracle AI Database + AWS] Oracle Database@AWSで広がるクラウドの新たな選択肢とAI時代のデータ戦略
oracle4engineer
PRO
2
170
20260204_Midosuji_Tech
takuyay0ne
1
160
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
450
生成AIを活用した音声文字起こしシステムの2つの構築パターンについて
miu_crescent
PRO
3
210
Digitization部 紹介資料
sansan33
PRO
1
6.8k
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
240
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
1
1.6k
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
440
Building AI with AI
inesmontani
PRO
1
700
So, you think you're a good person
axbom
PRO
2
1.9k
How to Ace a Technical Interview
jacobian
281
24k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
590
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
110
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
Google's AI Overviews - The New Search
badams
0
910
[SF Ruby Conf 2025] Rails X
palkan
1
760
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