Skip to content

Instantly share code, notes, and snippets.

@brunoandradd
Created November 17, 2013 19:51
Show Gist options
  • Save brunoandradd/7517437 to your computer and use it in GitHub Desktop.
Save brunoandradd/7517437 to your computer and use it in GitHub Desktop.
class ResumosFinanceirosController < ApplicationController
before_filter do
@consulta_previa = ConsultaPrevia.find(params[:consulta_previa_id])
end
def edit
@investimentos = Investimentos.new(@consulta_previa.empreendimento)
@fontes = Fontes.new(@consulta_previa.empreendimento)
@resumo_financeiro = @consulta_previa.empreendimento.resumo_financeiro
end
def update
@resumo_financeiro = @consulta_previa.empreendimento.resumo_financeiro
@resumo_financeiro.update_attributes(params[:resumo_financeiro])
respond_with @resumo_financeiro,
location: edit_consulta_previa_empreendimento_resumo_financeiro_path(@consulta_previa)
end
def create
@resumo_financeiro = ResumoFinanceiro.new(params[:resumo_financeiro])
@resumo_financeiro.save
respond_with @resumo_financeiro,
location: edit_consulta_previa_empreendimento_resumo_financeiro_path(@consulta_previa)
end
end
@brunoandradd
Copy link
Author

Exemplo de um controller, que constumo fazer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment