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
JJUG CCC 2026 Spring AI時代の開発こそ標準化を武器に! ― 方式・プロセス・プラットフォームの標準化
s27watanabe
2
720
Unlocking the Apps
pimterry
0
230
Dynamic Workersについて
yusukebe
2
590
実装は速くなった、レビューはどうする? ― 自身のレビューをAIで再現させるサーヴァントエンジニアリングのすゝめ / Implementation got faster. So what about reviews? — An invitation to Servant Engineering: Recreating your own code reviews with AI
nrslib
6
3.8k
noUncheckedIndexedAccess、3時間、1万円。 / noUncheckedIndexedAccess, 3 Hours, 10,000 JPY.
kaonavi
1
300
MIERUNE JCT 発表資料「宇宙から伊能忠敬ごっこ」
syuchimu
0
180
「気づいたら仕事が終わっている」バクラクAIエージェント本番運用の裏側 / layerx-bakuraku-aie2026
yuya4
18
10k
Platform engineering for developers, architects & the rest of us (AI agents)
danielbryantuk
0
180
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development with AI-DLC
yoshidashingo
0
140
個人の発見を、組織の知恵に 〜生成AI活用を"探索"から"組織の仕組み"へ〜
kintotechdev
2
980
Agentic Web
dynamis
1
130
AI Engineering Summit Tokyo 2026 AIの前に、やることがある 〜医療データ企業の4フェーズ〜
dtaniwaki
0
1.8k
Featured
See All Featured
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Statistics for Hackers
jakevdp
799
230k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
150
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Designing for Performance
lara
611
70k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
300
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
770
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
720
First, design no harm
axbom
PRO
2
1.2k
My Coaching Mixtape
mlcsv
0
140
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