Skip to content

STI will not pick up custom generator #15

@equivalent

Description

@equivalent

This works:

Foo < ActiveRecord::Base
     generate_public_uid generator: PublicUid::Generators::HexStringSecureRandom.new(50)
end

foo = Foo.new
foo.save!
foo.public_uid.length # => 50

this wil not


```ruby
Bar <Foo
end

foo = Foo.new
foo.save!
foo.public_uid.length # => 8

due to https://github.com/equivalent/public_uid/blob/master/lib/public_uid/model.rb#L25 instance method set the config is not copied across inheritance which is bad in this case

possible solution: use class variables @@generator =

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions