clowne-rb / clowne

A flexible gem for cloning models
https://clowne.evilmartians.io
MIT License
316 stars 18 forks source link

Is there possible to use traits in trait? #67

Open tbetous opened 2 years ago

tbetous commented 2 years ago

Hello there! 👋

Is there a way to use traits in trait like in factory_bot?

Here is an example :

class ListCloner < Clowne::Cloner
  trait :with_items do
    include_association :items
  end

  trait :special_list do
    with_items
    finalize do |_source, record, **_params|
      # Do some stuff...
    end
  end
end

Thanks for your work! ❤️