Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mvc sem Controller

1,376 views

Published on

LT no #qcon 2012

  • Be the first to comment

Mvc sem Controller

  1. 1. MVC sem Controller
  2. 2. http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch
  3. 3. Chamado.find(3).tramites
  4. 4. Chamado.find(3).tramites.to_sql
  5. 5. "SELECT `tramites`.* FROM `tramites` WHERE `tramites`.`chamado_id` = 3"
  6. 6. Engine vs Framework
  7. 7. class TramitesController < ApplicationController respond_to :html, :json def create @tramite = Tramite.create params[:tramite] respond_with @chamado, @tramite endend
  8. 8. Tramite.should_receive(:create).oncepost :create
  9. 9. @Resourcepublic class IndicacaoController { @Post @Consumes public void indicarOportunidade() { List oportunidades = new IndicacaoService() this.result.use(json()). WithoutRoot(). from(oportunidades). serialize(); }}
  10. 10. @Resourcepublic class IndicacaoController { @Post @Consumes public void indicarOportunidade(Indicacao) { List oportunidades = new IndicacaoService(Indicacao) this.result.use(json()). WithoutRoot(). from(oportunidades). serialize(); }}
  11. 11. @Resourcepublic class IndicacaoService { @Post @Consumes public void indicarOportunidade() { List oportunidades = fazAlgo() this.result.use(json()). WithoutRoot(). from(oportunidades). serialize(); }}
  12. 12. @Resourcepublic class IndicacaoService { @Post @Consumes public void indicarOportunidade() { List oportunidades = fazAlgo() this.result.use(json()). WithoutRoot(). from(oportunidades). serialize(); }}
  13. 13. @Resourcepublic class IndicacaoService { @Post @Consumes public List<Oportunidade> indicarOportunidade() { return fazAlgo(); }}
  14. 14. #QCON 2013:Services sem o nome Service

×