1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00
Maybe/app/models/transaction.rb
Ciocanel Razvan cca779d3c4
Feat transactions search (#532)
* gem: Add ransack gem

* feat: Implement transactions search
2024-03-11 08:51:16 -04:00

20 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