mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Scaffold out rules domain
This commit is contained in:
parent
b2d8da8857
commit
f12fc1efd7
16 changed files with 129 additions and 28 deletions
7
app/models/rule.rb
Normal file
7
app/models/rule.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Rule < ApplicationRecord
|
||||
belongs_to :family
|
||||
has_many :triggers, dependent: :destroy
|
||||
has_many :actions, dependent: :destroy
|
||||
|
||||
validates :effective_date, presence: true
|
||||
end
|
5
app/models/rule/action.rb
Normal file
5
app/models/rule/action.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class Rule::Action < ApplicationRecord
|
||||
belongs_to :rule
|
||||
|
||||
validates :action_type, presence: true
|
||||
end
|
7
app/models/rule/trigger.rb
Normal file
7
app/models/rule/trigger.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Rule::Trigger < ApplicationRecord
|
||||
self.table_name = "rule_triggers"
|
||||
|
||||
belongs_to :rule
|
||||
|
||||
validates :trigger_type, presence: true
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue