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
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
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
120
MUSUBIXとは
nahisaho
0
140
Fluid Templating in TYPO3 14
s2b
0
130
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.3k
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.4k
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
200
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
140
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
760
Claude Codeと2つの巻き戻し戦略 / Two Rewind Strategies with Claude Code
fruitriin
0
140
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
CSC307 Lecture 07
javiergs
PRO
1
550
AI時代の認知負荷との向き合い方
optfit
0
160
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
Into the Great Unknown - MozCon
thekraken
40
2.3k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
380
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
150
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
100
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
200
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
290
The untapped power of vector embeddings
frankvandijk
1
1.6k
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