SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
Timber App 
Ruby Rails Associations 
@PareidoliaX
Four Take Homes 
1. Associations are not database relationships but 
dependent on them. 
2. There is always a belongs_to side of the association. 
3. The table of the model of the belongs_to side of the 
association holds the information about the 
relationship. 
4. belongs_to works in migrations and generators.
Timber Iteration 1 
Requirements 
4 Tracks Lumberjacks and Lumberjills 
4 A Lumberjack or Lumberjill can choose on true love 
4 A Lumberjack or Lumberjill's profile shows all their 
admires
Todays Association: 
belongs_to and 
has_many
Based on the one to many 
database relationship
LumberJack Migration 
class CreateLumberjacks < ActiveRecord::Migration 
def change 
create_table :lumberjacks do |t| 
t.string :name 
t.belongs_to :lumberjill, index: true 
t.timestamps 
end 
end 
end
LumberJill Migration 
class CreateLumberjills < ActiveRecord::Migration 
def change 
create_table :lumberjills do |t| 
t.string :name 
t.belongs_to :lumberjack, index: true 
t.timestamps 
end 
end 
end
LumberJill Model 
class Lumberjill < ActiveRecord::Base 
belongs_to :lumberjack 
has_many :lumberjacks 
end
LumberJack Model 
class Lumberjack < ActiveRecord::Base 
belongs_to :lumberjill 
has_many :lumberjills 
end
Limitations of this solution 
+ Only one true love possible, can't handle complex relationships.
Four Take Homes 
1. Associations are not database relationships but 
dependent on them. 
2. There is always a belongs_to side of the association. 
3. The table of the model of the belongs_to side of the 
association holds the information about the 
relationship. 
4. belongs_to works in migrations and generators.
Find Me 
4 Twitter: @pareidoliax 
4 Website: pareidoliax.ca 
4 Github: pareidoliax 
4 email: xander.miller@gmail.com

Más contenido relacionado

Destacado

Patologies del reproductor
Patologies del reproductorPatologies del reproductor
Patologies del reproductorbertachico
 
20 Actividades Pizarra Digital
20 Actividades Pizarra Digital20 Actividades Pizarra Digital
20 Actividades Pizarra Digitalmarianaltaba
 
Ponencia Gestha al proyecto de modificación del IRPF
Ponencia Gestha al proyecto de modificación del IRPFPonencia Gestha al proyecto de modificación del IRPF
Ponencia Gestha al proyecto de modificación del IRPFNueva Canarias-BC
 
Boletin Informativo 01[1].12.09
Boletin Informativo 01[1].12.09Boletin Informativo 01[1].12.09
Boletin Informativo 01[1].12.09guest2550f1
 
Media recommendation for resto
Media recommendation for restoMedia recommendation for resto
Media recommendation for restodedy kustyono
 
Análisis tras 8 años de Ley de VIOGEN
Análisis tras 8 años de Ley de VIOGEN Análisis tras 8 años de Ley de VIOGEN
Análisis tras 8 años de Ley de VIOGEN @mereces_saberlo
 
Presentacion investigacion incidentes (2)
Presentacion   investigacion incidentes (2)Presentacion   investigacion incidentes (2)
Presentacion investigacion incidentes (2)Overallhealth En Salud
 
Programa de fiestas de San Mateo 2011 - Reinosa
Programa de fiestas de San Mateo 2011 - ReinosaPrograma de fiestas de San Mateo 2011 - Reinosa
Programa de fiestas de San Mateo 2011 - Reinosacharlyjc20
 
Templix Linux Y Mi Vecina
Templix   Linux Y Mi VecinaTemplix   Linux Y Mi Vecina
Templix Linux Y Mi VecinaRoberto Lopez
 
Tendencia actuales de la calidad y la productividad
Tendencia actuales de la calidad y la productividadTendencia actuales de la calidad y la productividad
Tendencia actuales de la calidad y la productividadLialbertm
 
STUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIA
STUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIASTUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIA
STUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIAijsrd.com
 
Protección de datos y LOPD en el caso de detectives privados
Protección de datos y LOPD en el caso de detectives privadosProtección de datos y LOPD en el caso de detectives privados
Protección de datos y LOPD en el caso de detectives privadosConversia
 
Efectos de los infrasonidos
Efectos de los infrasonidosEfectos de los infrasonidos
Efectos de los infrasonidosLuis Osbourne
 

Destacado (20)

Aplast
Aplast Aplast
Aplast
 
Patologies del reproductor
Patologies del reproductorPatologies del reproductor
Patologies del reproductor
 
CV J LE ROUX
CV J  LE ROUXCV J  LE ROUX
CV J LE ROUX
 
20 Actividades Pizarra Digital
20 Actividades Pizarra Digital20 Actividades Pizarra Digital
20 Actividades Pizarra Digital
 
Ponencia Gestha al proyecto de modificación del IRPF
Ponencia Gestha al proyecto de modificación del IRPFPonencia Gestha al proyecto de modificación del IRPF
Ponencia Gestha al proyecto de modificación del IRPF
 
catalog-metalurgiei-park
catalog-metalurgiei-parkcatalog-metalurgiei-park
catalog-metalurgiei-park
 
Boletin Informativo 01[1].12.09
Boletin Informativo 01[1].12.09Boletin Informativo 01[1].12.09
Boletin Informativo 01[1].12.09
 
Dsdsdsds
DsdsdsdsDsdsdsds
Dsdsdsds
 
Arte romanico
Arte romanicoArte romanico
Arte romanico
 
Media recommendation for resto
Media recommendation for restoMedia recommendation for resto
Media recommendation for resto
 
Cveurope ohotel
Cveurope ohotelCveurope ohotel
Cveurope ohotel
 
Análisis tras 8 años de Ley de VIOGEN
Análisis tras 8 años de Ley de VIOGEN Análisis tras 8 años de Ley de VIOGEN
Análisis tras 8 años de Ley de VIOGEN
 
Presentacion investigacion incidentes (2)
Presentacion   investigacion incidentes (2)Presentacion   investigacion incidentes (2)
Presentacion investigacion incidentes (2)
 
Programa de fiestas de San Mateo 2011 - Reinosa
Programa de fiestas de San Mateo 2011 - ReinosaPrograma de fiestas de San Mateo 2011 - Reinosa
Programa de fiestas de San Mateo 2011 - Reinosa
 
Templix Linux Y Mi Vecina
Templix   Linux Y Mi VecinaTemplix   Linux Y Mi Vecina
Templix Linux Y Mi Vecina
 
Tendencia actuales de la calidad y la productividad
Tendencia actuales de la calidad y la productividadTendencia actuales de la calidad y la productividad
Tendencia actuales de la calidad y la productividad
 
STUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIA
STUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIASTUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIA
STUDIES OF PHYSICO-CHEMICAL STATUS OF THE SIRPUR TALAB AT INDORE, INDIA
 
Protección de datos y LOPD en el caso de detectives privados
Protección de datos y LOPD en el caso de detectives privadosProtección de datos y LOPD en el caso de detectives privados
Protección de datos y LOPD en el caso de detectives privados
 
Ponencia Grupo Soledad-TNU - Crevillente 17-07-2012
 Ponencia Grupo Soledad-TNU - Crevillente 17-07-2012 Ponencia Grupo Soledad-TNU - Crevillente 17-07-2012
Ponencia Grupo Soledad-TNU - Crevillente 17-07-2012
 
Efectos de los infrasonidos
Efectos de los infrasonidosEfectos de los infrasonidos
Efectos de los infrasonidos
 

Último

GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxSasikiranMarri
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...kalichargn70th171
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsDEEPRAJ PATHAK
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxRTS corp
 
Key Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapKey Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapIshara Amarasekera
 

Último (20)

GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software Projects
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptx
 
Key Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapKey Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery Roadmap
 

Basic Timber App - Rails Associatios

  • 1. Timber App Ruby Rails Associations @PareidoliaX
  • 2. Four Take Homes 1. Associations are not database relationships but dependent on them. 2. There is always a belongs_to side of the association. 3. The table of the model of the belongs_to side of the association holds the information about the relationship. 4. belongs_to works in migrations and generators.
  • 3. Timber Iteration 1 Requirements 4 Tracks Lumberjacks and Lumberjills 4 A Lumberjack or Lumberjill can choose on true love 4 A Lumberjack or Lumberjill's profile shows all their admires
  • 5. Based on the one to many database relationship
  • 6. LumberJack Migration class CreateLumberjacks < ActiveRecord::Migration def change create_table :lumberjacks do |t| t.string :name t.belongs_to :lumberjill, index: true t.timestamps end end end
  • 7. LumberJill Migration class CreateLumberjills < ActiveRecord::Migration def change create_table :lumberjills do |t| t.string :name t.belongs_to :lumberjack, index: true t.timestamps end end end
  • 8. LumberJill Model class Lumberjill < ActiveRecord::Base belongs_to :lumberjack has_many :lumberjacks end
  • 9. LumberJack Model class Lumberjack < ActiveRecord::Base belongs_to :lumberjill has_many :lumberjills end
  • 10. Limitations of this solution + Only one true love possible, can't handle complex relationships.
  • 11. Four Take Homes 1. Associations are not database relationships but dependent on them. 2. There is always a belongs_to side of the association. 3. The table of the model of the belongs_to side of the association holds the information about the relationship. 4. belongs_to works in migrations and generators.
  • 12. Find Me 4 Twitter: @pareidoliax 4 Website: pareidoliax.ca 4 Github: pareidoliax 4 email: xander.miller@gmail.com