Class: BankAccount
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- BankAccount
- Defined in:
- app/models/bank_account.rb
Overview
Bank account information for a given reimbursement. Defined as a separate model in the shake of cleanest.
Instance Attribute Summary collapse
- #bank_name ⇒ String
- #bank_postal_address ⇒ String
- #bic ⇒ String
- #country_code ⇒ String
- #created_at ⇒ DateTime
- #format ⇒ String
- #holder ⇒ String
- #iban ⇒ String
- #national_account_code ⇒ String
- #national_bank_code ⇒ String
- #updated_at ⇒ DateTime
Belongs to collapse
-
#reimbursement ⇒ Reimbursement
The associated reimbursement.
Class Method Summary collapse
-
.human_format_name(format) ⇒ String
Internationalized version of an account format.
Instance Method Summary collapse
-
#human_format_name ⇒ String
Internationalized version of the format.
-
#iban? ⇒ Boolean
Checks if the 'iban' format is selected.
-
#national? ⇒ Boolean
Checks if the 'national' format is selected.
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes
Instance Attribute Details
#bank_name ⇒ String
Validations (unless => -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? } ):
13 |
# File 'app/models/bank_account.rb', line 13 validates :bank_name, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? } |
#bank_postal_address ⇒ String
46 |
# File 'db/schema.rb', line 46 t.string "bank_postal_address" |
#bic ⇒ String
Validations (unless => -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || !iban? } ):
15 |
# File 'app/models/bank_account.rb', line 15 validates :iban, :bic, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || !iban? } |
#country_code ⇒ String
Validations (unless => -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || iban? } ):
16 |
# File 'app/models/bank_account.rb', line 16 validates :national_account_code, :country_code, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || iban? } |
#created_at ⇒ DateTime
48 |
# File 'db/schema.rb', line 48 t.datetime "created_at" |
#format ⇒ String
Validations:
14 |
# File 'app/models/bank_account.rb', line 14 validates :format, presence: true, inclusion: { in: %w[iban national] } |
#holder ⇒ String
Validations (unless => -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? } ):
12 |
# File 'app/models/bank_account.rb', line 12 validates :holder, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? } |
#iban ⇒ String
Validations (unless => -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || !iban? } ):
15 |
# File 'app/models/bank_account.rb', line 15 validates :iban, :bic, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || !iban? } |
#national_account_code ⇒ String
Validations (unless => -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || iban? } ):
16 |
# File 'app/models/bank_account.rb', line 16 validates :national_account_code, :country_code, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || iban? } |
#national_bank_code ⇒ String
43 |
# File 'db/schema.rb', line 43 t.string "national_bank_code" |
#updated_at ⇒ DateTime
49 |
# File 'db/schema.rb', line 49 t.datetime "updated_at" |
Class Method Details
.human_format_name(format) ⇒ String
Internationalized version of an account format
38 39 40 |
# File 'app/models/bank_account.rb', line 38 def self.human_format_name(format) I18n.t("activerecord.models.bank_account.formats.#{format}") end |
Instance Method Details
#human_format_name ⇒ String
Internationalized version of the format
45 46 47 |
# File 'app/models/bank_account.rb', line 45 def human_format_name BankAccount.human_format_name(format) end |
#iban? ⇒ Boolean
Checks if the 'iban' format is selected
23 24 25 |
# File 'app/models/bank_account.rb', line 23 def iban? format == 'iban' end |
#national? ⇒ Boolean
Checks if the 'national' format is selected
30 31 32 |
# File 'app/models/bank_account.rb', line 30 def national? format == 'national' end |
#reimbursement ⇒ Reimbursement
The associated reimbursement
Validations:
9 |
# File 'app/models/bank_account.rb', line 9 belongs_to :reimbursement, inverse_of: :bank_account |