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
57
0
Share
Rails Bootcamp [Sesión 03]
A. Felipe Cabargas Madrid
June 04, 2016
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
28
Untangling git
felipecabargas
0
60
Docker 101
felipecabargas
1
83
GroupRaise Learning Fridays: UX 101
felipecabargas
0
98
GroupRaise Learning Fridays: Hows and whys of version control
felipecabargas
0
49
Sesion III - Taller RoR LCC
felipecabargas
0
92
Sesion II - Taller RoR LCC
felipecabargas
0
120
Taller RoR LCC
felipecabargas
0
150
Other Decks in Programming
See All in Programming
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
910
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
330
Feature Toggle は捨てやすく使おう
gennei
0
580
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
780
Kubernetes上でAgentを動かすための最新動向と押さえるべき概念まとめ
sotamaki0421
3
490
JAWS-UG横浜 #100 祝・第100回スペシャルAWS は VPC レスの時代へ
maroon1st
0
110
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
210
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
3分でわかるatama plusのQA/about atama plus QA
atamaplus
0
160
実践CRDT
tamadeveloper
0
510
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
310
PDI: Como Alavancar Sua Carreira e Seu Negócio
marcelgsantos
0
120
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
150
Google's AI Overviews - The New Search
badams
0
970
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
290
The SEO Collaboration Effect
kristinabergwall1
0
420
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
380
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
160
Game over? The fight for quality and originality in the time of robots
wayneb77
1
160
How to Talk to Developers About Accessibility
jct
2
170
Why Our Code Smells
bkeepers
PRO
340
58k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
Visualization
eitanlees
150
17k
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