Mvc sem Controller

1,309 views

Published on

LT no #qcon 2012

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,309
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
14
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

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

×