Adopt Rails 5 belongs_to_required_by_default
This commit is contained in:
parent
2557645f4f
commit
44a198c7bc
23 changed files with 53 additions and 38 deletions
|
|
@ -1,12 +1,12 @@
|
|||
# financial transactions are the foodcoop internal financial transactions
|
||||
# only ordergroups have an account balance and are happy to transfer money
|
||||
class FinancialTransaction < ApplicationRecord
|
||||
belongs_to :ordergroup
|
||||
belongs_to :ordergroup, optional: true
|
||||
belongs_to :user
|
||||
belongs_to :financial_link
|
||||
belongs_to :financial_link, optional: true
|
||||
belongs_to :financial_transaction_type
|
||||
belongs_to :group_order
|
||||
belongs_to :reverts, class_name: 'FinancialTransaction', foreign_key: 'reverts_id'
|
||||
belongs_to :group_order, optional: true
|
||||
belongs_to :reverts, optional: true, class_name: 'FinancialTransaction', foreign_key: 'reverts_id'
|
||||
has_one :reverted_by, class_name: 'FinancialTransaction', foreign_key: 'reverts_id'
|
||||
|
||||
validates_presence_of :amount, :note, :user_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue