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
62
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
60
Accesibilidad Web: Que, como, cuando y por que?
felipecabargas
0
32
Untangling git
felipecabargas
0
62
Docker 101
felipecabargas
1
87
GroupRaise Learning Fridays: UX 101
felipecabargas
0
100
GroupRaise Learning Fridays: Hows and whys of version control
felipecabargas
0
54
Sesion III - Taller RoR LCC
felipecabargas
0
94
Sesion II - Taller RoR LCC
felipecabargas
0
130
Taller RoR LCC
felipecabargas
0
150
Other Decks in Programming
See All in Programming
AI-DLC Deep Dive
yuukiyo
9
5.9k
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
350
cloudnative conference 2026 flyle
azihsoyn
0
180
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1.1k
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
180
【ディップ|26年新卒研修資料】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
160
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
360
ハーネスエンジニアリングとは?
kinopeee
13
7k
継続的な負荷検証を目指して
pyama86
3
1.2k
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
3
920
AgentCore Optimizationを始めよう!
licux
3
240
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
700
Featured
See All Featured
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
230
Designing for Timeless Needs
cassininazir
1
220
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
500
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
440
Agile that works and the tools we love
rasmusluckow
331
21k
Abbi's Birthday
coloredviolet
2
7.6k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
270
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