SlideShare a Scribd company logo
1 of 57
Introducción  a  Ruby On Rails Ing. Pablo Marrero
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introducción Ing. Pablo Marrero ,[object Object],[object Object],[object Object],Java Hibernate TopLink JPA EJB Spring Struts JSF Ruby on Rails
Introducción Ing. Pablo Marrero ,[object Object],[object Object],[object Object],Java Hibernate TopLink JPA EJB Spring Struts JSF Ruby on Rails Active Record Action Pack Action View Action Controller
Introducción Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Modelo Vista Controlador Browser BD
Introducción Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Ruby Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Ruby Ing. Pablo Marrero ,[object Object],[object Object],[object Object]
Pilares de RoR Ruby Ing. Pablo Marrero ,[object Object],[object Object],[object Object]
Pilares de RoR Ruby Ing. Pablo Marrero ,[object Object],variable_local @variable_de_instancia @@variable_de_clase $variable_global Clase CONSTANTE :simbolo metodo_de_instancia self.metodo_de_clase modifico_el_objeto! devuelvo_booleano?
Pilares de RoR Ruby Ing. Pablo Marrero Las estructuras  devuelven  el valor de la ultima expresión evaluada: @user = if params[:id] User.find(params[:id]) else User.new end
Pilares de RoR Ruby Ing. Pablo Marrero @post = Post.find(params[:id]) if @post @post.destroy end Mejor: if @post = Post.find(params[:id]) @post.destroy end
Pilares de RoR Ruby Ing. Pablo Marrero Asignaciones condicionales @title = "Tıtulo generico" unless defined?(@title) @title ||= "Tıtulo generico“ @heading = if defined?(@subsection) @subsection.title else @section.title end @heading = ( @subsection || @section ).title
Pilares de RoR Ruby Ing. Pablo Marrero Arrays @arr = [ 1, 2, 3, 4, 5 ] Iterando: @arr.each do |item| puts item end Que es el for de toda la vida: for item in @arr puts item end
Pilares de RoR Ruby Ing. Pablo Marrero Utilidades Varias para Arrays .uniq [1,1,2,3,3].uniq >> [1,2,3] .flatten [[1,1],2,[3,3]].flatten >> [1,1,2,3,3] .compact [1,nil,2,nil,3].compact >> [1,2,3] .reverse [1,1,2,3,3].reverse >> [3,3,2,1,1] .sort [1,3,2,1,3].sort >> [1,1,2,3,3] .find [1,2,3].find {|n| n % 3 == 0 } >> 3 [1,2,3].find {|n| n % 5 == 0 } >> nil .find_all [1,3,5,6].find_all {|n| n % 3 == 0 } >> [3,6] [1,2,3].find_all {|n| n % 5 == 0 } >> []
Pilares de RoR Ruby Ing. Pablo Marrero Que pasa con las clases? class Persona def nombre @nombre end def nombre=(nombre) @nombre = nombre end end No mas getter y setter!! class Persona attr_accesor :nombre, :apellido attr_reader :id attr_writer :notas end
Pilares de RoR Ruby Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],Yukihiro Matsumoto Often people, especially computer engineers, focus on the machines. They think, "By doing this, the machine will run faster. By doing this, the machine will run more efectively. By doing this, the machine will something something something."They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves. ,[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Convención sobre Configuración Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Convención sobre Configuración Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Dont Repeat Yourself Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Dont Repeat Yourself Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Active Record Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Migrations Ing. Pablo Marrero ,[object Object],[object Object],[object Object]
Pilares de RoR Migrations Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Migrations Ing. Pablo Marrero ,[object Object],[object Object]
Pilares de RoR Migrations Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Migrations Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Migrations Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pilares de RoR Migrations Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A Codificar! Instalación de Ruby y RoR Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A Codificar! Instalación de Ruby y RoR Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object]
A Codificar! Instalación de Ruby y RoR Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A Codificar! Herramientas de Desarrollo Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A Codificar! Mini Proyecto Ing. Pablo Marrero ,[object Object]
Recursos Web Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Libros Ing. Pablo Marrero ,[object Object],[object Object]
¿ Preguntas ? Ing. Pablo Marrero
Referencias Ing. Pablo Marrero ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Muchas Gracias! Ing. Pablo Marrero ,[object Object],[object Object]

More Related Content

Similar to Introducción a RubyOnRails

Meetup training Taller RoR
Meetup training Taller RoR Meetup training Taller RoR
Meetup training Taller RoR cdechauri
 
Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009Nelson Rojas Núñez
 
Presentacion Ruby on Rails CTIC-Cusco2007
Presentacion Ruby on Rails CTIC-Cusco2007Presentacion Ruby on Rails CTIC-Cusco2007
Presentacion Ruby on Rails CTIC-Cusco2007JuancaPompilla
 
Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012
Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012
Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012Alfredo Chavez
 
Taller evento TestingUY 2016 - Automatización de Pruebas con Ruby
Taller evento TestingUY 2016 - Automatización de Pruebas con RubyTaller evento TestingUY 2016 - Automatización de Pruebas con Ruby
Taller evento TestingUY 2016 - Automatización de Pruebas con RubyTestingUy
 
Ruby on the Rails
Ruby on the RailsRuby on the Rails
Ruby on the Rails000ari2014
 
Ruby On Rails Jun2009
Ruby On Rails Jun2009Ruby On Rails Jun2009
Ruby On Rails Jun2009Sergio Alonso
 
Introduccion A Php
Introduccion A PhpIntroduccion A Php
Introduccion A Phputs
 
Introduccion A Php
Introduccion A PhpIntroduccion A Php
Introduccion A Phputs
 
Introduccion A Php
Introduccion A PhpIntroduccion A Php
Introduccion A Phputs
 
Ruby on Rails - ETyC 2011
Ruby on Rails - ETyC 2011Ruby on Rails - ETyC 2011
Ruby on Rails - ETyC 2011Rafael Franco
 
Desarrollo de Aplicaciones con Ruby on Rails y PostgreSQL
Desarrollo de Aplicaciones con Ruby on Rails y PostgreSQLDesarrollo de Aplicaciones con Ruby on Rails y PostgreSQL
Desarrollo de Aplicaciones con Ruby on Rails y PostgreSQLJosé Alfredo Ramírez
 
Ruby es un lenguaje de programación interpretado
Ruby es un lenguaje de programación interpretadoRuby es un lenguaje de programación interpretado
Ruby es un lenguaje de programación interpretadoYulgrecia2011
 
5 tips para programar en Ruby On Rails
5 tips para programar en Ruby On Rails 5 tips para programar en Ruby On Rails
5 tips para programar en Ruby On Rails kyaalena
 
Programacion web
Programacion webProgramacion web
Programacion webIACSA
 
Conceptos básicos y aplicaciones prácticas de programación para SEO
Conceptos básicos y aplicaciones prácticas de programación para SEOConceptos básicos y aplicaciones prácticas de programación para SEO
Conceptos básicos y aplicaciones prácticas de programación para SEOnacho mascort
 

Similar to Introducción a RubyOnRails (20)

Python django
Python djangoPython django
Python django
 
Meetup training Taller RoR
Meetup training Taller RoR Meetup training Taller RoR
Meetup training Taller RoR
 
Grails barcamp 2013
Grails barcamp 2013Grails barcamp 2013
Grails barcamp 2013
 
Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009
 
Presentacion Ruby on Rails CTIC-Cusco2007
Presentacion Ruby on Rails CTIC-Cusco2007Presentacion Ruby on Rails CTIC-Cusco2007
Presentacion Ruby on Rails CTIC-Cusco2007
 
Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012
Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012
Retos en la Adopción del Refactoring - Junta General del MexALN 28/06/2012
 
Taller evento TestingUY 2016 - Automatización de Pruebas con Ruby
Taller evento TestingUY 2016 - Automatización de Pruebas con RubyTaller evento TestingUY 2016 - Automatización de Pruebas con Ruby
Taller evento TestingUY 2016 - Automatización de Pruebas con Ruby
 
Java jaucito
Java jaucitoJava jaucito
Java jaucito
 
Ruby on the Rails
Ruby on the RailsRuby on the Rails
Ruby on the Rails
 
Ruby On Rails Jun2009
Ruby On Rails Jun2009Ruby On Rails Jun2009
Ruby On Rails Jun2009
 
Introduccion A Php
Introduccion A PhpIntroduccion A Php
Introduccion A Php
 
Introduccion A Php
Introduccion A PhpIntroduccion A Php
Introduccion A Php
 
Introduccion A Php
Introduccion A PhpIntroduccion A Php
Introduccion A Php
 
Ruby on Rails - ETyC 2011
Ruby on Rails - ETyC 2011Ruby on Rails - ETyC 2011
Ruby on Rails - ETyC 2011
 
Desarrollo de Aplicaciones con Ruby on Rails y PostgreSQL
Desarrollo de Aplicaciones con Ruby on Rails y PostgreSQLDesarrollo de Aplicaciones con Ruby on Rails y PostgreSQL
Desarrollo de Aplicaciones con Ruby on Rails y PostgreSQL
 
Ruby es un lenguaje de programación interpretado
Ruby es un lenguaje de programación interpretadoRuby es un lenguaje de programación interpretado
Ruby es un lenguaje de programación interpretado
 
5 tips para programar en Ruby On Rails
5 tips para programar en Ruby On Rails 5 tips para programar en Ruby On Rails
5 tips para programar en Ruby On Rails
 
Programacion web
Programacion webProgramacion web
Programacion web
 
FULLSTACK JS DEV in 2017
FULLSTACK JS DEV in 2017FULLSTACK JS DEV in 2017
FULLSTACK JS DEV in 2017
 
Conceptos básicos y aplicaciones prácticas de programación para SEO
Conceptos básicos y aplicaciones prácticas de programación para SEOConceptos básicos y aplicaciones prácticas de programación para SEO
Conceptos básicos y aplicaciones prácticas de programación para SEO
 

Recently uploaded

POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...silviayucra2
 
Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfsoporteupcology
 
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE  DE TECNOLOGIA E INFORMATICA PRIMARIACLASE  DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIAWilbisVega
 
Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx241521559
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxLolaBunny11
 
Herramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptxHerramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptxRogerPrieto3
 
9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudianteAndreaHuertas24
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITMaricarmen Sánchez Ruiz
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveFagnerLisboa3
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)GDGSucre
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan JosephBRAYANJOSEPHPEREZGOM
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricKeyla Dolores Méndez
 
KELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesKELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesFundación YOD YOD
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdfIsabellaMontaomurill
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíassuserf18419
 

Recently uploaded (15)

POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
 
Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdf
 
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE  DE TECNOLOGIA E INFORMATICA PRIMARIACLASE  DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
 
Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptx
 
Herramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptxHerramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptx
 
9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNIT
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial Uninove
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Joseph
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
 
KELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesKELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento Protégeles
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdf
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnología
 

Introducción a RubyOnRails

  • 1. Introducción a Ruby On Rails Ing. Pablo Marrero
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Pilares de RoR Ruby Ing. Pablo Marrero Las estructuras devuelven el valor de la ultima expresión evaluada: @user = if params[:id] User.find(params[:id]) else User.new end
  • 13. Pilares de RoR Ruby Ing. Pablo Marrero @post = Post.find(params[:id]) if @post @post.destroy end Mejor: if @post = Post.find(params[:id]) @post.destroy end
  • 14. Pilares de RoR Ruby Ing. Pablo Marrero Asignaciones condicionales @title = "Tıtulo generico" unless defined?(@title) @title ||= "Tıtulo generico“ @heading = if defined?(@subsection) @subsection.title else @section.title end @heading = ( @subsection || @section ).title
  • 15. Pilares de RoR Ruby Ing. Pablo Marrero Arrays @arr = [ 1, 2, 3, 4, 5 ] Iterando: @arr.each do |item| puts item end Que es el for de toda la vida: for item in @arr puts item end
  • 16. Pilares de RoR Ruby Ing. Pablo Marrero Utilidades Varias para Arrays .uniq [1,1,2,3,3].uniq >> [1,2,3] .flatten [[1,1],2,[3,3]].flatten >> [1,1,2,3,3] .compact [1,nil,2,nil,3].compact >> [1,2,3] .reverse [1,1,2,3,3].reverse >> [3,3,2,1,1] .sort [1,3,2,1,3].sort >> [1,1,2,3,3] .find [1,2,3].find {|n| n % 3 == 0 } >> 3 [1,2,3].find {|n| n % 5 == 0 } >> nil .find_all [1,3,5,6].find_all {|n| n % 3 == 0 } >> [3,6] [1,2,3].find_all {|n| n % 5 == 0 } >> []
  • 17. Pilares de RoR Ruby Ing. Pablo Marrero Que pasa con las clases? class Persona def nombre @nombre end def nombre=(nombre) @nombre = nombre end end No mas getter y setter!! class Persona attr_accesor :nombre, :apellido attr_reader :id attr_writer :notas end
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55. ¿ Preguntas ? Ing. Pablo Marrero
  • 56.
  • 57.