Add deposits controller

This commit is contained in:
Martin Lensment 2015-04-09 11:19:49 +03:00
parent 5c0e2be387
commit 13c94aeb1c
10 changed files with 88 additions and 4 deletions

23
app/models/deposit.rb Normal file
View file

@ -0,0 +1,23 @@
class Deposit
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :amount, :description, :registrar
validates :amount, :registrar, presence: true
def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end
def persisted?
false
end
def issue_prepayment_invoice
valid? && registrar.issue_prepayment_invoice(amount, description)
end
end