Sha256: 5b021ed10237fb66f5ecbd4330769505818c35573c83e37837eafdc725ee8386
Contents?: true
Size: 853 Bytes
Versions: 3
Compression:
Stored size: 853 Bytes
Contents
# Active Record Clowne provides an optional ActiveRecord integration which allows you to configure cloners in your models and adds a shortcut to invoke cloners (`#clowne` method). To enable this integration, you must require `"clowne/adapters/active_record/dsl"` somewhere in your app, e.g., in the initializer: ```ruby # config/initializers/clowne.rb require "clowne/adapters/active_record/dsl" Clowne.default_adapter = :active_record ``` Now you can specify cloning configs in your AR models: ```ruby class User < ActiveRecord::Base clowne_config do include_associations :profile nullify :email # whatever available for your cloners, # active_record adapter is set implicitly here end end ``` And then you can clone objects like this: ```ruby user.clowne(traits: my_traits, **params).to_record # => <#User id: nil...> ```
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clowne-1.4.0 | docs/active_record.md |
clowne-1.3.0 | docs/active_record.md |
clowne-1.2.0 | docs/active_record.md |