This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Carro | |
def Carro.valor_do_financiamento(carro_id) | |
carro = Carro.find(carro_id) | |
#calcula valor | |
return valor_total | |
end | |
end | |
carro = Carro.find(params[:carro_id]) # carrega o carro que o usuario passou no POST | |
valor_do_financiamento = Carro.valor_do_financiamento(carro.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mst | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def before(method_name) | |
m = instance_method(method_name) | |
define_method method_name do |*args, &block| |
NewerOlder