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
82
GroupRaise Learning Fridays: UX 101
felipecabargas
0
97
GroupRaise Learning Fridays: Hows and whys of version control
felipecabargas
0
49
Sesion III - Taller RoR LCC
felipecabargas
0
88
Sesion II - Taller RoR LCC
felipecabargas
0
120
Taller RoR LCC
felipecabargas
0
150
Other Decks in Programming
See All in Programming
へんな働き方
yusukebe
6
2.8k
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
4.2k
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
110
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
7
3.1k
Understanding Apache Lucene - More than just full-text search
spinscale
0
140
OTP を自動で入力する裏技
megabitsenmzq
0
130
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
210
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
6
1.1k
Claude Code Skill入門
mayahoney
0
440
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
190
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
180
Featured
See All Featured
Believing is Seeing
oripsolob
1
96
Statistics for Hackers
jakevdp
799
230k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
410
We Have a Design System, Now What?
morganepeng
55
8k
How STYLIGHT went responsive
nonsquared
100
6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The SEO identity crisis: Don't let AI make you average
varn
0
420
Design in an AI World
tapps
0
180
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Building AI with AI
inesmontani
PRO
1
820
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
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