mirror of
https://github.com/we-promise/sure.git
synced 2026-06-01 16:59:03 +00:00
21 lines
376 B
Ruby
21 lines
376 B
Ruby
class Transaction < ApplicationRecord
|
|
belongs_to :account
|
|
belongs_to :category, optional: true
|
|
|
|
after_commit :sync_account
|
|
|
|
def self.ransackable_attributes(auth_object = nil)
|
|
%w[name amount date]
|
|
end
|
|
|
|
def self.ransackable_associations(auth_object = nil)
|
|
%w[category account]
|
|
end
|
|
|
|
private
|
|
|
|
def sync_account
|
|
self.account.sync_later
|
|
end
|
|
end
|