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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1k
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
130
CSC307 Lecture 10
javiergs
PRO
1
660
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
1
110
Fluid Templating in TYPO3 14
s2b
0
130
Architectural Extensions
denyspoltorak
0
290
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
690
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
200
Patterns of Patterns
denyspoltorak
0
1.4k
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
83
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
150
Code Reviewing Like a Champion
maltzj
527
40k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
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