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
A. Felipe Cabargas Madrid
June 04, 2016
Programming
0
56
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
26
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
82
Sesion II - Taller RoR LCC
felipecabargas
0
120
Taller RoR LCC
felipecabargas
0
140
Other Decks in Programming
See All in Programming
Agentに至る道 〜なぜLLMは自動でコードを書けるようになったのか〜
mackee
5
1.9k
Evolving NEWT’s TypeScript Backend for the AI-Driven Era
xpromx
0
150
Micro Frontendsで築いた 共通基盤と運用の試行錯誤 / Building a Shared Platform with Micro Frontends: Operational Learnings
kyntk
0
100
Doc Translate - LLMを活用したコードドキュメント自動翻訳VSCode拡張機能
eycjur
0
100
CloudflareのSandbox SDKを試してみた
syumai
0
180
DartASTとその活用
sotaatos
2
140
GeistFabrik and AI-augmented software development
adewale
PRO
0
130
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
4.6k
GraalVM Native Image トラブルシューティング機能の最新状況(2025年版)
ntt_dsol_java
0
160
Amazon Bedrock Knowledge Bases Hands-on
konny0311
0
150
Claude Code on the Web を超える!? Codex Cloud の実践テク5選
sunagaku
0
590
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
10
5.2k
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
A better future with KSS
kneath
239
18k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
[RailsConf 2023] Rails as a piece of cake
palkan
57
6.1k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
The Cult of Friendly URLs
andyhume
79
6.7k
Producing Creativity
orderedlist
PRO
348
40k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
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