Skip to content

Commit

Permalink
fix(validations): ignore default before_validation (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasalexandre9 authored Dec 10, 2024
1 parent 01c2309 commit 436e9a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/services/forest_liana/schema_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,11 @@ def add_default_value(column_schema, column)
def add_validations(column_schema, column)
# NOTICE: Do not consider validations if a before_validation Active Records
# Callback is detected.
if @model._validation_callbacks.map(&:kind).include? :before
default_callback_excluded = [:normalize_changed_in_place_attributes]
if @model._validation_callbacks
.reject { |callback| default_callback_excluded.include?(callback.filter) }
.map(&:kind).include?(:before)

return column_schema
end

Expand Down

0 comments on commit 436e9a6

Please sign in to comment.