A toda máquina con  Ruby on Rails Rafael García Ortega – ASPgems [email_address]
CSS XHTML Web 2.0 Usabilidad Wiki Standards AJAX Redes Sociales RSS APIs REST Mashups Folksonomy Soap Clouds ASAP Movilidad Tags Avatar Dinámico Estático CMS ASP SaaS Networking Microblogging Streaming Colaboración Open Social
Ruby Man is driven to create; I know I really love to create things.  And while I'm not good at painting, drawing, or music,  I can write software. Yukihiro Matsumoto, a.k.a. “Matz”
Ruby Lenguaje dinámico Multiparadigma Orientado a objetos Lenguaje de muy alto nivel Basado en Perl, Smalltalk, Lisp, C, … ...
Ruby Lenguaje natural
Ruby Lenguaje natural Fácil de leer
Ruby Lenguaje natural Fácil de leer Fácil de escribir
Ruby Lenguaje natural Fácil de leer Fácil de escribir Productivo
Ruby ¡DIVERTIDO! Lenguaje natural Fácil de leer Fácil de escribir Productivo
Todo son objetos
123 "Ruby" true =>  Fixnum =>  String =>  TrueClass
-123.abs "Ruby".index('b') true.nil? 5 * 10 => 123 => 2 => false => 50
-123.abs "Ruby".index('b') true.nil? 5 * 10 5.*(10) => 123 => 2 => false => 50 => 50
Fácil de leer
Time.now
Time.now 100.next
Time.now 100.next “ Cadena”.downcase.reverse
Time.now 100.next “ Cadena”.downcase.reverse 5.times { print 'hola mundo' }
Convenciones
current_user :login_required @activated @@counter Status
a = [5, 1, 9, 2] a.empty?  => false
a a.sort a => [5, 1, 9, 2] => [1, 2, 5, 9] => [5, 1, 9, 2]
a a.sort! a => [5, 1, 9, 2] => [1, 2, 5, 9] => [1, 2, 5, 9]
Flexible
class String  def repeat(i) self * i end end
"hola mundo".repeat(4) class String  def repeat(i) self * i end end "Rioja Party 2009".repeat(4)
"hola mundo".repeat(4) class String  def repeat(i) self * i end end class String undef_method :repeat end
Array (Enumerable)
class String undef_method :repeat end foo = [1, 2, 3] foo << 4 =>  [1,2,3,4]
foo = %w(uno dos tres)  foo[1] => ['uno', 'dos', 'tres'] => 'dos'
foo = [1, 2, 3] bar = [3, 4, 5] foo+bar => [1, 2, 3, 3, 4, 5]
foo = [1, 2, 3] bar = [3, 4, 5] foo+bar foo * 2 => [1, 2, 3, 3, 4, 5] => [1, 2, 3, 1, 2, 3]
foo = [1, 2, 3] bar = [3, 4, 5] foo+bar foo * 2 foo & bar => [1, 2, 3, 3, 4, 5] => [1, 2, 3, 1, 2, 3] => [3]
foo = [1, 2, 3] bar = [3, 4, 5] foo+bar foo * 2 foo & bar foo | bar => [1, 2, 3, 3, 4, 5] => [1, 2, 3, 1, 2, 3] => [3] => [1, 2, 3, 4, 5]
foo.each do |item| puts item end
a.inject(0){|sum,item| sum + item}
a.inject(0){|sum,item| sum + item} a.map{|item| item*2 }
a.inject(0){|sum,item| sum + item} a.map{|item| item*2 } (1..100).find_all{|item| item % 3 == 0}
Ruby on Rails The best way to predict the future is to implement it. David Heinemeier Hansson, a.k.a. “DHH” &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
Ruby on Rails Extraído a partir de Basecamp &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
Ruby on Rails Extraído a partir de Basecamp Patrón MVC &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
Ruby on Rails Extraído a partir de Basecamp Patrón MVC DRY – Don't repeat yourself &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
Ruby on Rails Extraído a partir de Basecamp Patrón MVC DRY – Don't repeat yourself COC – Conv. Over Config. &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
Ruby on Rails Extraído a partir de Basecamp Patrón MVC DRY – Don't repeat yourself COC – Conv. Over Config. Ágil &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
Instalación Linux {aptitude, yum} install ruby rubygems gem update –system geim install rails Mac OS X Leopard Gem update –system Gem install rails Mac OS X Tiger Locomotive One-Click Installer Windows InstantRails One Click Installer
DEMO
Rafael García Ortega – ASPgems [email_address] ¿Preguntas?
Enlaces Para aprender: Rails – Guides -  http://guides.rubyonrails.org/ Página principal de Ruby: Ruby -  http://www.ruby-lang.org/ Página principal de RoR: Ruby on Rails -  http://rubyonrails.org/ API: Ruby(API) -  http://ruby-doc.org/core/ RoR(API) -  http://api.rubyonrails.org/ Consulta: Google -  http://google.com Lista RoR-es -  http://lists.simplelogica.net/mailman/listinfo/ror-es &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
Enlaces Presenatción basada en: Agile Web Development with Rails ed. Pragmatic Programmers http://www.slideshare.net/jmorrison/rochester-on-rails-introduction-to-ruby http://www.slideshare.net/agnessa/introduction-to-ruby-on-rails http://www.slideshare.net/herval/love-ruby-each-i-p-i http://rubisobrerieles.blogspot.com/2007/01/introduccin-rails-por-thecocktail.html http://www.slideshare.net/sergio.gil/ruby-mola-y-por-qu http://www.slideshare.net/rafaelgaspar/ruby-on-rails-embarque-nesse-framework-web ... &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.

A Toda Maquina Con Ruby on Rails

  • 1.
    A toda máquinacon Ruby on Rails Rafael García Ortega – ASPgems [email_address]
  • 2.
    CSS XHTML Web2.0 Usabilidad Wiki Standards AJAX Redes Sociales RSS APIs REST Mashups Folksonomy Soap Clouds ASAP Movilidad Tags Avatar Dinámico Estático CMS ASP SaaS Networking Microblogging Streaming Colaboración Open Social
  • 3.
    Ruby Man isdriven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software. Yukihiro Matsumoto, a.k.a. “Matz”
  • 4.
    Ruby Lenguaje dinámicoMultiparadigma Orientado a objetos Lenguaje de muy alto nivel Basado en Perl, Smalltalk, Lisp, C, … ...
  • 5.
  • 6.
    Ruby Lenguaje naturalFácil de leer
  • 7.
    Ruby Lenguaje naturalFácil de leer Fácil de escribir
  • 8.
    Ruby Lenguaje naturalFácil de leer Fácil de escribir Productivo
  • 9.
    Ruby ¡DIVERTIDO! Lenguajenatural Fácil de leer Fácil de escribir Productivo
  • 10.
  • 11.
    123 &quot;Ruby&quot; true=> Fixnum => String => TrueClass
  • 12.
    -123.abs &quot;Ruby&quot;.index('b') true.nil?5 * 10 => 123 => 2 => false => 50
  • 13.
    -123.abs &quot;Ruby&quot;.index('b') true.nil?5 * 10 5.*(10) => 123 => 2 => false => 50 => 50
  • 14.
  • 15.
  • 16.
  • 17.
    Time.now 100.next “Cadena”.downcase.reverse
  • 18.
    Time.now 100.next “Cadena”.downcase.reverse 5.times { print 'hola mundo' }
  • 19.
  • 20.
  • 21.
    a = [5,1, 9, 2] a.empty? => false
  • 22.
    a a.sort a=> [5, 1, 9, 2] => [1, 2, 5, 9] => [5, 1, 9, 2]
  • 23.
    a a.sort! a=> [5, 1, 9, 2] => [1, 2, 5, 9] => [1, 2, 5, 9]
  • 24.
  • 25.
    class String def repeat(i) self * i end end
  • 26.
    &quot;hola mundo&quot;.repeat(4) classString def repeat(i) self * i end end &quot;Rioja Party 2009&quot;.repeat(4)
  • 27.
    &quot;hola mundo&quot;.repeat(4) classString def repeat(i) self * i end end class String undef_method :repeat end
  • 28.
  • 29.
    class String undef_method:repeat end foo = [1, 2, 3] foo << 4 => [1,2,3,4]
  • 30.
    foo = %w(unodos tres) foo[1] => ['uno', 'dos', 'tres'] => 'dos'
  • 31.
    foo = [1,2, 3] bar = [3, 4, 5] foo+bar => [1, 2, 3, 3, 4, 5]
  • 32.
    foo = [1,2, 3] bar = [3, 4, 5] foo+bar foo * 2 => [1, 2, 3, 3, 4, 5] => [1, 2, 3, 1, 2, 3]
  • 33.
    foo = [1,2, 3] bar = [3, 4, 5] foo+bar foo * 2 foo & bar => [1, 2, 3, 3, 4, 5] => [1, 2, 3, 1, 2, 3] => [3]
  • 34.
    foo = [1,2, 3] bar = [3, 4, 5] foo+bar foo * 2 foo & bar foo | bar => [1, 2, 3, 3, 4, 5] => [1, 2, 3, 1, 2, 3] => [3] => [1, 2, 3, 4, 5]
  • 35.
    foo.each do |item|puts item end
  • 36.
  • 37.
    a.inject(0){|sum,item| sum +item} a.map{|item| item*2 }
  • 38.
    a.inject(0){|sum,item| sum +item} a.map{|item| item*2 } (1..100).find_all{|item| item % 3 == 0}
  • 39.
    Ruby on RailsThe best way to predict the future is to implement it. David Heinemeier Hansson, a.k.a. “DHH” &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
  • 40.
    Ruby on RailsExtraído a partir de Basecamp &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
  • 41.
    Ruby on RailsExtraído a partir de Basecamp Patrón MVC &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
  • 42.
    Ruby on RailsExtraído a partir de Basecamp Patrón MVC DRY – Don't repeat yourself &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
  • 43.
    Ruby on RailsExtraído a partir de Basecamp Patrón MVC DRY – Don't repeat yourself COC – Conv. Over Config. &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
  • 44.
    Ruby on RailsExtraído a partir de Basecamp Patrón MVC DRY – Don't repeat yourself COC – Conv. Over Config. Ágil &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
  • 45.
    Instalación Linux {aptitude,yum} install ruby rubygems gem update –system geim install rails Mac OS X Leopard Gem update –system Gem install rails Mac OS X Tiger Locomotive One-Click Installer Windows InstantRails One Click Installer
  • 46.
  • 47.
    Rafael García Ortega– ASPgems [email_address] ¿Preguntas?
  • 48.
    Enlaces Para aprender:Rails – Guides - http://guides.rubyonrails.org/ Página principal de Ruby: Ruby - http://www.ruby-lang.org/ Página principal de RoR: Ruby on Rails - http://rubyonrails.org/ API: Ruby(API) - http://ruby-doc.org/core/ RoR(API) - http://api.rubyonrails.org/ Consulta: Google - http://google.com Lista RoR-es - http://lists.simplelogica.net/mailman/listinfo/ror-es &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.
  • 49.
    Enlaces Presenatción basadaen: Agile Web Development with Rails ed. Pragmatic Programmers http://www.slideshare.net/jmorrison/rochester-on-rails-introduction-to-ruby http://www.slideshare.net/agnessa/introduction-to-ruby-on-rails http://www.slideshare.net/herval/love-ruby-each-i-p-i http://rubisobrerieles.blogspot.com/2007/01/introduccin-rails-por-thecocktail.html http://www.slideshare.net/sergio.gil/ruby-mola-y-por-qu http://www.slideshare.net/rafaelgaspar/ruby-on-rails-embarque-nesse-framework-web ... &quot;Rails&quot;, &quot;Ruby on Rails&quot;, and the Rails logo are trademarks of David Heinemeier Hansson.