Skip to content

Model with ActiveStorage attachment can't be anonymized #19

@billabel

Description

@billabel

When I try to anonymize a model with an active storage attachment. E.g. User with a profile picture

# lib/extensions/evil_seed.rb

require "evil_seed"

EvilSeed.configure do |config|
  config.root("User", id: 13055) do |root|
    root.exclude(/.*/) # exclude all associations
  end

  config.anonymize("User") do
    name { Faker::Name.name }
  end
end

I get a method_missing for has_one_attached on this model.

/Users/billabel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/activerecord-6.1.7.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `has_one_attached' for User:Class (NoMethodError)

Is there a fix or workaround? Is this a ruby 3.2 issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions