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 Bootcamp [Sesión 03]
Search
A. Felipe Cabargas Madrid
June 04, 2016
Programming
0
57
Rails Bootcamp [Sesión 03]
A. Felipe Cabargas Madrid
June 04, 2016
Tweet
Share
More Decks by A. Felipe Cabargas Madrid
See All by A. Felipe Cabargas Madrid
Layers Layers Layers
felipecabargas
0
55
Accesibilidad Web: Que, como, cuando y por que?
felipecabargas
0
27
Untangling git
felipecabargas
0
60
Docker 101
felipecabargas
1
80
GroupRaise Learning Fridays: UX 101
felipecabargas
0
96
GroupRaise Learning Fridays: Hows and whys of version control
felipecabargas
0
49
Sesion III - Taller RoR LCC
felipecabargas
0
87
Sesion II - Taller RoR LCC
felipecabargas
0
120
Taller RoR LCC
felipecabargas
0
140
Other Decks in Programming
See All in Programming
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.3k
SourceGeneratorのススメ
htkym
0
200
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
Claude Codeと2つの巻き戻し戦略 / Two Rewind Strategies with Claude Code
fruitriin
0
140
dchart: charts from deck markup
ajstarks
3
1k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
600
AI & Enginnering
codelynx
0
120
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
200
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.4k
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1k
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
260
First, design no harm
axbom
PRO
2
1.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Discover your Explorer Soul
emna__ayadi
2
1.1k
A Soul's Torment
seathinner
5
2.3k
Abbi's Birthday
coloredviolet
1
4.8k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
56
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
Utilizing Notion as your number one productivity tool
mfonobong
3
220
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
830
Fireside Chat
paigeccino
41
3.8k
Transcript
RAILS BOOTCAMP 3 JUNIO 2016
ACTIVERECORD
Modelos
$ rails generate model Person
/app/models/person.rb
Migraciones
/db/migrate
$ rake db:migrate
Crear modelo de datos de tu app recuerden migrar los
nuevos modelos
Jugando con la consola de rails recuerden migrar los nuevos
modelos
$ rails console
p = Person.first
p.name
Person.all
Crear asociaciones
$ rails generate migration AddReferencesToBook person:references
app/models/person.rb class Person < ActiveRecord::Base has_many :books # has_one :book
end
app/models/book.rb class Book < ActiveRecord::Base belongs_to :person end
Crear validaciones
app/models/person.rb class Person < ActiveRecord::Base validates :name, presence: true end
Callbacks
before_save after_save before_create after_create before_validation after_validation
app/models/person.rb class Person < ActiveRecord::Base before_save :count_pets def count_pets if
self.email.nil? puts "No tiene mail" else puts "Yeih! #{self.email}" end end end