$30 off During Our Annual Pro Sale. View Details »
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
170
[Wheel Lab #2] Apple Service with Rails.
hechien
0
80
[Sokoos][教育訓練] Git - 1
hechien
0
150
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
110
[作業] 創意美學
hechien
0
57
[教育訓練] Rails Form Basic
hechien
1
74
Rails Layout Basic
hechien
2
120
Other Decks in Technology
See All in Technology
useEffectってなんで非推奨みたいなこと言われてるの?
maguroalternative
9
6.2k
オープンデータの内製化から分かったGISデータを巡る行政の課題
naokim84
2
1.3k
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
0
640
なぜ使われないのか?──定量×定性で見極める本当のボトルネック
kakehashi
PRO
1
780
たかが特別な時間の終わり / It's Only the End of Special Time
watany
3
860
pmconf2025 - 他社事例を"自社仕様化"する技術_iRAFT法
daichi_yamashita
0
510
生成AI時代の自動E2Eテスト運用とPlaywright実践知_引持力哉
legalontechnologies
PRO
0
100
Modern Data Stack大好きマンが語るSnowflakeの魅力
sagara
0
280
Active Directory 勉強会 第 6 回目 Active Directory セキュリティについて学ぶ回
eurekaberry
16
6k
Capture Checking / Separation Checking 入門
tanishiking
0
110
小さな判断で育つ、大きな意思決定力 / 20251204 Takahiro Kinjo
shift_evolve
PRO
1
300
生成AI・AIエージェント時代、データサイエンティストは何をする人なのか?そして、今学生であるあなたは何を学ぶべきか?
kuri8ive
2
1.8k
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
990
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Raft: Consensus for Rubyists
vanstee
140
7.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
For a Future-Friendly Web
brad_frost
180
10k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
120
20k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.1k
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
80
Into the Great Unknown - MozCon
thekraken
40
2.2k
Building Applications with DynamoDB
mza
96
6.8k
Side Projects
sachag
455
43k
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