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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
A. Felipe Cabargas Madrid
June 04, 2016
Programming
68
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
68
Accesibilidad Web: Que, como, cuando y por que?
felipecabargas
0
48
Untangling git
felipecabargas
0
71
Docker 101
felipecabargas
1
94
GroupRaise Learning Fridays: UX 101
felipecabargas
0
110
GroupRaise Learning Fridays: Hows and whys of version control
felipecabargas
0
59
Sesion III - Taller RoR LCC
felipecabargas
0
100
Sesion II - Taller RoR LCC
felipecabargas
0
130
Taller RoR LCC
felipecabargas
0
150
Other Decks in Programming
See All in Programming
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
230
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
490
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
710
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
0
130
MySQLとPostgreSQLって何が違うの?
akagami
0
120
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
110
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.7k
Flow は今どうなっているか
mizdra
PRO
0
640
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
110
Android CLI
fornewid
0
230
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
1
140
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
730
Featured
See All Featured
Making Projects Easy
brettharned
120
6.7k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Code Reviewing Like a Champion
maltzj
528
40k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
250
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
210
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
370
Code Review Best Practice
trishagee
74
20k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
410
Into the Great Unknown - MozCon
thekraken
41
2.7k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
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