Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[教育訓練] Rails Validation Basic
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
HeChien Hsu
September 04, 2012
Technology
110
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
64
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
190
[Wheel Lab #2] Apple Service with Rails.
hechien
0
97
[Sokoos][教育訓練] Git - 1
hechien
0
160
[數位教學] 用Bootstrap製作網頁
hechien
0
1.4k
DesignYou - 專題報告投影片
hechien
0
140
[作業] 創意美學
hechien
0
73
[教育訓練] Rails Form Basic
hechien
1
88
Rails Layout Basic
hechien
2
140
Other Decks in Technology
See All in Technology
2026-09-11 【Snowflake World Tour Tokyo 2026】Snowflakeを起点に、AI Agentが自律稼働し続ける未来へ / Driving AI Agents with Snowflake
civitaspo
0
660
SREは、MCPとAutopilotをこう使え!
kazumax55
3
850
バイブコーディング時代のWebアプリ開発入門~Cloud Runで学ぶセキュアなビルドとデプロイ
waiwai2111
1
130
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
5
630
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
5
1.7k
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
1.6k
Reactの設計論
uhyo
24
13k
AI時代の「技術的負債」の変質ー概念の終焉と再解釈、エージェントと共に向かう先
nwiizo
1
2.7k
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
500
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
Screen Lens - 今見てる画面を翻訳する
komagata
0
320
Goodbye ShellScript, Hello File-based App
shunsock
0
120
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
280
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
290
From π to Pie charts
rasagy
1
370
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Making Projects Easy
brettharned
120
6.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Un-Boring Meetings
codingconduct
0
420
Embracing the Ebb and Flow
colly
88
5.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
How STYLIGHT went responsive
nonsquared
100
6.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
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