Palestra "Do PHP ao Rails"

Post on 18-Jan-2015

3.253 views 0 download

description

Palestra sobre experiência pessoal da migração do PHP para Rails. Ministrada no CEET Vasco Coutinho (http://ceetvascocoutinho.com.br/) - Ciclo de Palestras

Transcript of Palestra "Do PHP ao Rails"

Almir 'm3nd3s'Almir 'm3nd3s'@m3nd3s@m3nd3s

http://www.almirmendes.comhttp://www.almirmendes.com m3nd3s@gmail.com m3nd3s@gmail.com

http://www.flickr.com/photos/tswicegood/3483353187

Do PHP ao RailsDo PHP ao Rails

Quem esse kra mesmo?

Como vou saber?Ele não se

apresentou.

http://www.flickr.com/photos/mysticpenguin/3310104535/

Sou eu!Sou eu!

http://www.flickr.com/photos/chealion/2349587639

http://www.flickr.com/photos/rdohms/4103026062

PHPPHP

http://www.flickr.com/photos/hlegius/3544338710

Linux + PHPLinux + PHP

Oi!

Por que mudar?Por que mudar?

10.times { |i| puts i }

CICI

http://www.dojosp.org/?p=59

TDDTDD

http://www.flickr.com/photos/dhaun/5626938236

CI CI

Agilidade Agilidade http://www.flickr.com/photos/eriwst/3448608210

Tempo é dinheiroTempo é dinheiro

http://www.flickr.com/photos/lindenbaum/345980717

10.class=> Fixnum

OO OO

GambiarrasGambiarras

http://www.flickr.com

/photos/ricardo_

ferreira/233163

380/

<?php<?php

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

?>?>

Mercado Mercado

http://www.flickr.com/photos/hongiiv/2937154327

http://www.100loop.com/flex/mvc-e-flex/

MVCMVC

$ rails –help

Usage: rails COMMAND [ARGS]

The most common rails commands are:

generate Generate new code (short-cut alias: "g")

console Start the Rails console (short-cut alias: "c")

server Start the Rails server (short-cut alias: "s")

dbconsole Start a console for the database

(short-cut alias: "db")

new Create a new Rails application.

ComandosComandos

Migrations Migrations

http://www.flickr.com/photos/nickpix2008/2209582828/

Migrations Migrations

class Usuario < ActiveRecord::Base

end

Model Model

app/models/usuarios/usuario.rb

u = Usuario.new(:login => 'm3nd3s')

Model Model

u.save()

u.valid?()

u.destroy

Usuario.all

Usuario.last(5)

Usuario.find(1)

Model Model

...

class UsuariosController < ApplicationController

def index

@usuario = Usuario.all

end

end

Controller Controller

app/controllers/usuarios/usuarios_controller.rb

View View

<h1><%= @usuario.title %></h1>

app/views/usuarios/index.html.rb

http://www.flickr.com/photos/laserstars/3086132328

Gostei,Por onde começo?!

Rails for zumbies Rails for zumbies

Rails 3 screencasts Rails 3 screencasts

Rails for zumbies Rails for zumbies

RailsGuidesRailsGuides

GemsGems

RailsRumbleRailsRumble

AdenaAdena

Almir 'm3nd3s'Almir 'm3nd3s'@m3nd3s@m3nd3shttp://www.almirmendes.comhttp://www.almirmendes.comalmir.mendes@giran.com.bralmir.mendes@giran.com.br