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
97
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
55
[Kaohsiung Rails meetup] 國際化影片分享網站
hechien
0
180
[Wheel Lab #2] Apple Service with Rails.
hechien
0
91
[Sokoos][教育訓練] Git - 1
hechien
0
160
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
130
[作業] 創意美學
hechien
0
67
[教育訓練] Rails Form Basic
hechien
1
86
Rails Layout Basic
hechien
2
130
Other Decks in Technology
See All in Technology
チームで実践する AI-DLC 思考の軌跡を残すチェックポイント設計
belongadmin
0
2.6k
LLMと共に進化するプロセスを目指して
ymatsuwitter
11
3k
Djangoユーザが知っ得なPostgreSQL機能 - 設計の選択肢を増やす / Djang-use-PostgreSQL
soudai
PRO
0
180
「コーディング」しない人のための Claude Code 入門 ChatGPT の次の一歩 — 業務に組み込む 育成・共有・自動化
rfdnxbro
2
1.2k
Databricks 月刊サービスアップデート 2026年05月号
tyosi1212
0
210
サプライチェーンセキュリティの空白地帯 - 信頼できる”依存性”の未来を考える
rung
PRO
2
690
DevOps Agentで始めるAWS運用 〜フロンティアエージェントが変える運用の現場〜
nyankotaro
1
220
ポケモンの型をTypeScriptの型システムで表現してみた
subroh0508
0
320
Chart.js が簡単に使えるようになっていたので OGP 画像生成に使った話
kamekyame
0
160
Terraformモジュールは、なぜ「魔境」化するのか
hayama17
1
190
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
480
正解のないAIプロダクトをどう導くか?dodaが挑む、ユーザーの『本音』を構造化する評価設計と検証のリアル
techtekt
PRO
0
180
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
220
Un-Boring Meetings
codingconduct
0
310
Docker and Python
trallard
47
3.9k
Odyssey Design
rkendrick25
PRO
2
690
Utilizing Notion as your number one productivity tool
mfonobong
4
310
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
BBQ
matthewcrist
89
10k
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