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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
A. Felipe Cabargas Madrid
June 04, 2016
Programming
70
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
74
Accesibilidad Web: Que, como, cuando y por que?
felipecabargas
0
50
Untangling git
felipecabargas
0
73
Docker 101
felipecabargas
1
96
GroupRaise Learning Fridays: UX 101
felipecabargas
0
110
GroupRaise Learning Fridays: Hows and whys of version control
felipecabargas
0
61
Sesion III - Taller RoR LCC
felipecabargas
0
100
Sesion II - Taller RoR LCC
felipecabargas
0
140
Taller RoR LCC
felipecabargas
0
160
Other Decks in Programming
See All in Programming
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
320
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
340
Hono + Inertia + React で LP を構築した話
oukayuka
2
210
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.8k
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
160
[KotlinConf Extended South Korea 2026] KotlinConf 2026 발표자 후기
wisemuji
0
100
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
120
XHTMLが残したもの
yosuke_furukawa
PRO
1
410
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
420
自分的「カンファレンスの楽しみ方」
syumai
0
190
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
470
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
270
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
AI: The stuff that nobody shows you
jnunemaker
PRO
9
970
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
890
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
260
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
440
Mind Mapping
helmedeiros
1
350
Measuring & Analyzing Core Web Vitals
bluesmoon
9
990
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