Add model and views for bank accounts
This commit is contained in:
parent
4b1e9a6f53
commit
f0a55fb951
24 changed files with 351 additions and 1 deletions
12
app/models/bank_account.rb
Normal file
12
app/models/bank_account.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class BankAccount < ActiveRecord::Base
|
||||
|
||||
has_many :bank_transactions, dependent: :destroy
|
||||
|
||||
normalize_attributes :name, :iban, :description
|
||||
|
||||
validates :name, :presence => true, :uniqueness => true, :length => { :minimum => 2 }
|
||||
validates :iban, :presence => true, :uniqueness => true
|
||||
validates_format_of :iban, :with => /\A[A-Z]{2}[0-9]{2}[0-9A-Z]{,30}\z/
|
||||
validates_numericality_of :balance, :message => I18n.t('bank_account.model.invalid_balance')
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue