SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
Almir 'm3nd3s'
                                                     http://www.almirmendes.com
                                                          m3nd3s@gmail.com
http://www.flickr.com/photos/bellalago/4874839499/     http://www.flickr.com/photos/tswicegood/3483353187
It's me
http://www.flickr.com/photos/chealion/2349587639
http://www.flickr.com/photos/rdohms/4103026062
http://www.flickr.com/photos/hlegius/3544338710
Oi!
Por que mudar?
Agilidade




            http://www.flickr.com/photos/eriwst/3448608210
10.times { |i| puts i }
10.class
=> Fixnum
Dojo
http://reddevnews.com/articles/2007/11/01/testdriven-development-tdd.aspx
Continuous Integration
Ufa! Me
                              Time
livrei dessa   Você quebrou
                  o build?
Gambiarras



http://www.flickr.com/photos/ricardo_ferreira/233163380/
<?php

echo “2Patos” +
     “1Galinha” +
     “2Codornas” == “5 Pássaros?”

  // Acredite! Isto resulta em 1 (inteiro)

?>
Mercado
Então, o que é o tal
  Ruby on Rails?
http://www.flickr.com/photos/benmillett/306074038




                         A web framework that's optimized for
                         programmer happiness and sustainable
                         productivity.
http://www.flickr.com/photos/arcticpuppy/4784727073




It lets you write beautiful code by
favoring convention over configuration.
http://www.codinguide.com/2010/04/mvc-pattern.html



MVC
Exemplo


  Imagine que eu precise gerenciar
usuários, estes teriam apenas nome e
                e-mail.
Instala a gem rails




$ gem install rails


$ rails new meu_projeto



     Cria um novo projeto
$ cd meu_projeto


$ rails g model usuario nome:string
email:string
class CreateUsuarios < ActiveRecord::Migration
  def self.up
        create_table :usuarios do |t|
           t.string nome
           t.string email
           t.timestamps
        end
  dnd


   def self.down
        drop_table :usuarios


end
   end
                                         Migration
$ rake db:migrate




                    Migration
Model


class Usuario < ActiveRecord::Base
end




                        app/models/usuario.rb
Model
u.save?()                    Usuario.all

u.update_attributes()    Usuario.last(5)

u.destroy()             Usuario.find(12)

u.valid?()                 Usuario.new

u.errors                 Usuario.query

u.new_record?            Usuario.first()

u.meu_atributo_x
                           E muito mais...
Controller

class UsuariosController < ApplicationController


      def index
            @usuarios = Usuario.all
      end


end
               app/controllers/usuarios_controller.rb
View

   <ul>
       <% @usuarios.each do |u| %>
          <%= u.nome %>
       <% end %>
   </ul>

                                Action


          app/views/usuarios/index.html.rb
Gems




       http://rubygems.org/
       http://rubygems.org/
Por onde começar?
http://railsforzombies.org/
http://railsforzombies.org/
http://rubyonrails.org/screencasts/rails3
http://rubyonrails.org/screencasts/rails3
http://railscasts.com/
http://railscasts.com/
http://guides.rubyonrails.org/
http://guides.rubyonrails.org/
RailsRumble
www.rockandrails.com.br


                          Realização
Almir 'm3nd3s'
@m3nd3s
http://www.almirmendes.com
almir.mendes@giran.com.br

Más contenido relacionado

La actualidad más candente (10)

Future of Web Development
Future of Web DevelopmentFuture of Web Development
Future of Web Development
 
Engines
EnginesEngines
Engines
 
Amplexor - Drupal Camp Romania 2015 - Front-end testing
Amplexor - Drupal Camp Romania 2015 - Front-end testingAmplexor - Drupal Camp Romania 2015 - Front-end testing
Amplexor - Drupal Camp Romania 2015 - Front-end testing
 
Browserify
BrowserifyBrowserify
Browserify
 
Html1
Html1Html1
Html1
 
I motion
I motionI motion
I motion
 
Vmware
Vmware Vmware
Vmware
 
RSpec. Part 1
RSpec. Part 1RSpec. Part 1
RSpec. Part 1
 
Flash Widget Tutorial
Flash Widget TutorialFlash Widget Tutorial
Flash Widget Tutorial
 
Hp26簡報 joyhsu
Hp26簡報 joyhsuHp26簡報 joyhsu
Hp26簡報 joyhsu
 

Destacado (9)

Arduino Project
Arduino ProjectArduino Project
Arduino Project
 
La Celula
La CelulaLa Celula
La Celula
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
 
PresentacióN Pigmento 1
PresentacióN Pigmento 1PresentacióN Pigmento 1
PresentacióN Pigmento 1
 
Palestra de SED - Stream Editor
Palestra de SED - Stream EditorPalestra de SED - Stream Editor
Palestra de SED - Stream Editor
 
10+ Coisas Que Odeio Em Php
10+ Coisas Que Odeio Em Php10+ Coisas Que Odeio Em Php
10+ Coisas Que Odeio Em Php
 
Arduino Project - Ciclo de palestras CEET Vasco Coutinho
Arduino Project - Ciclo de palestras CEET Vasco CoutinhoArduino Project - Ciclo de palestras CEET Vasco Coutinho
Arduino Project - Ciclo de palestras CEET Vasco Coutinho
 
Dicas de SSH
Dicas de SSHDicas de SSH
Dicas de SSH
 
Innovacion
InnovacionInnovacion
Innovacion
 

Similar a Palestra "Do PHP ao Rails" - FOCAI

Action Controller Overview, Season 2
Action Controller Overview, Season 2Action Controller Overview, Season 2
Action Controller Overview, Season 2
RORLAB
 
Ruby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 AjaxRuby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 Ajax
Wen-Tien Chang
 

Similar a Palestra "Do PHP ao Rails" - FOCAI (20)

Palestra "Do PHP ao Rails"
Palestra "Do PHP ao Rails"Palestra "Do PHP ao Rails"
Palestra "Do PHP ao Rails"
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2
 
Two database findings
Two database findingsTwo database findings
Two database findings
 
Creating effective ruby gems
Creating effective ruby gemsCreating effective ruby gems
Creating effective ruby gems
 
Advanced RESTful Rails
Advanced RESTful RailsAdvanced RESTful Rails
Advanced RESTful Rails
 
Advanced RESTful Rails
Advanced RESTful RailsAdvanced RESTful Rails
Advanced RESTful Rails
 
Rupicon 2014 Action pack
Rupicon 2014 Action packRupicon 2014 Action pack
Rupicon 2014 Action pack
 
Action Controller Overview, Season 2
Action Controller Overview, Season 2Action Controller Overview, Season 2
Action Controller Overview, Season 2
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
 
Ruby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 AjaxRuby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 Ajax
 
StirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with SailsStirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with Sails
 
The Rails Way
The Rails WayThe Rails Way
The Rails Way
 
ActiveResource & REST
ActiveResource & RESTActiveResource & REST
ActiveResource & REST
 
Rails 4.0
Rails 4.0Rails 4.0
Rails 4.0
 
More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weibo
 
Using ArcGIS Server with Ruby on Rails
Using ArcGIS Server with Ruby on RailsUsing ArcGIS Server with Ruby on Rails
Using ArcGIS Server with Ruby on Rails
 
Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010
 
Rails::Engine
Rails::EngineRails::Engine
Rails::Engine
 

Más de Almir Mendes

Más de Almir Mendes (12)

Software Livre, que história é essa?
Software Livre, que história é essa?Software Livre, que história é essa?
Software Livre, que história é essa?
 
[Rock'n Rails] Deploying Rails Applications with Capistrano
[Rock'n Rails] Deploying Rails Applications with Capistrano[Rock'n Rails] Deploying Rails Applications with Capistrano
[Rock'n Rails] Deploying Rails Applications with Capistrano
 
Projeto Arduino - Hardware para fazer coisas legais - FOCAI
Projeto Arduino - Hardware para fazer coisas legais - FOCAIProjeto Arduino - Hardware para fazer coisas legais - FOCAI
Projeto Arduino - Hardware para fazer coisas legais - FOCAI
 
Arduino Project :: Giran Siege
Arduino Project :: Giran SiegeArduino Project :: Giran Siege
Arduino Project :: Giran Siege
 
Integração contínua com Hudson CI
Integração contínua com Hudson CIIntegração contínua com Hudson CI
Integração contínua com Hudson CI
 
Palestra sobre AWK [Giran Siege]
Palestra sobre AWK [Giran Siege]Palestra sobre AWK [Giran Siege]
Palestra sobre AWK [Giran Siege]
 
Palestra regex
Palestra regexPalestra regex
Palestra regex
 
Palestra regex
Palestra regexPalestra regex
Palestra regex
 
Palestra de PDO
Palestra de PDOPalestra de PDO
Palestra de PDO
 
Distribuições Linux
Distribuições LinuxDistribuições Linux
Distribuições Linux
 
Entendendo como fazer um firewall pessoal
Entendendo como fazer um firewall pessoalEntendendo como fazer um firewall pessoal
Entendendo como fazer um firewall pessoal
 
PHP Day - PHP para iniciantes
PHP Day - PHP para iniciantesPHP Day - PHP para iniciantes
PHP Day - PHP para iniciantes
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

Palestra "Do PHP ao Rails" - FOCAI