Remove validations in investment changelog entries
If we validate the presence of the old value and the new value, changes in optional fields will not be stored if either the old value or the new value are blank.
This commit is contained in:
@@ -413,7 +413,7 @@ class Budget
|
||||
log.investment_id = self.id
|
||||
log.new_value = self.send field
|
||||
log.old_value = self.send "#{field}_was"
|
||||
!log.save
|
||||
log.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,8 +5,6 @@ class Budget::Investment::ChangeLog < ApplicationRecord
|
||||
inverse_of: :budget_investment_change_logs,
|
||||
required: false
|
||||
|
||||
validates :old_value, presence: true
|
||||
validates :new_value, presence: true
|
||||
validates :field, presence: true
|
||||
|
||||
scope :by_investment, ->(investment_id) { where(investment_id: investment_id) }
|
||||
|
||||
Reference in New Issue
Block a user