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
79
[教育訓練] 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
44
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
160
[Wheel Lab #2] Apple Service with Rails.
hechien
0
74
[Sokoos][教育訓練] Git - 1
hechien
0
150
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
110
[作業] 創意美學
hechien
0
55
[教育訓練] Rails Form Basic
hechien
1
70
Rails Layout Basic
hechien
2
120
Other Decks in Technology
See All in Technology
Ktor + Google Cloud Tasks/PubSub におけるOTel Messaging計装の実践
sansantech
PRO
1
330
alecthomas/kong はいいぞ
fujiwara3
6
1.1k
公開初日に個人環境で試した Gemini CLI 体験記など / Gemini CLI実験レポート
you
PRO
3
650
地域コミュニティへの「感謝」と「恩返し」 / 20250726jawsug-tochigi
kasacchiful
0
100
Expertise as a Service via MCP
yodakeisuke
1
160
Step Functions First - サーバーレスアーキテクチャの新しいパラダイム
taikis
1
280
FAST導入1年間のふりかえり〜現実を直視し、さらなる進化を求めて〜 / Review of the first year of FAST implementation
wooootack
1
190
株式会社島津製作所_研究開発(集団協業と知的生産)の現場を支える、OSS知識基盤システムの導入
akahane92
1
1.3k
スプリントレビューを効果的にするために
miholovesq
9
1.7k
LLM開発を支えるエヌビディアの生成AIエコシステム
acceleratedmu3n
0
340
ML Pipelineの開発と運用を OpenTelemetryで繋ぐ @ OpenTelemetry Meetup 2025-07
getty708
0
320
AI エンジニアの立場からみた、AI コーディング時代の開発の品質向上の取り組みと妄想
soh9834
8
590
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
5.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.6k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Why Our Code Smells
bkeepers
PRO
337
57k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
47
9.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Making Projects Easy
brettharned
117
6.3k
The Cost Of JavaScript in 2023
addyosmani
51
8.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.8k
For a Future-Friendly Web
brad_frost
179
9.8k
Docker and Python
trallard
45
3.5k
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