active_interaction-extras icon indicating copy to clipboard operation
active_interaction-extras copied to clipboard

ActiveInteraction 4.0.2 removed method `populate_filters`

Open danieldraper opened this issue 5 years ago • 1 comments

ActiveInteraction 4.0.2 has removed the method populate_filters which is overridden in lib/active_interaction/extras/model_fields.rb and breaks existing functionality.

The full changes are which break a number of things https://github.com/AaronLasseigne/active_interaction/compare/v4.0.1...v4.0.2

# == Schema Information
#
# Table name: people
#
#  id                        :uuid             not null, primary key
#  metadata                  :jsonb            not null, defualt: {}
#  name                      :text             not null
class Person < ApplicationRecord
end
class CreatePersonInteraction < ApplicationInteraction
  object :person

  model_fields :person do
    string :name
    hash :metadata
  end

  validate { MetadataValidatorInteraction.run!(metadata: metadata) }

  def execute
    # ...
  end
end
class MetadataValidatorInteraction < ApplicationInteraction
  hash :metadata, default: nil

  validate do
    # 4.0.1 this works fine and returns db default {}, 4.0.2 this returns nil
    raise ArgumentError unless metadata.is_a?(Hash)
  end

  def execute; end
end

danieldraper avatar Jun 23 '21 05:06 danieldraper

Thanks for the detailed research @danieldraper 💯

Fixed in v1.0.2

antulik avatar Jul 07 '21 11:07 antulik