docs/parameters.md in clowne-1.1.0 vs docs/parameters.md in clowne-1.2.0

- old
+ new

@@ -1,9 +1,6 @@ ---- -id: parameters -title: Parameters ---- +# Parameters Clowne provides parameters for make your cloning logic more flexible. You can see their using in [`include_association`](include_association.md#scope) and [`finalize`](finalize.md) documentation pages. Example: @@ -14,11 +11,11 @@ finalize do |_source, record, params| record.email = params[:email] end end -operation = UserCloner.call(user, state: :draft, email: 'cloned@example.com') +operation = UserCloner.call(user, state: :draft, email: "cloned@example.com") cloned = operation.to_record cloned.email # => 'cloned@example.com' ``` @@ -40,11 +37,11 @@ end ``` ## Nested Parameters -Also we implemented control over the parameters for cloning associations (you can read more [here](https://github.com/palkan/clowne/issues/15)). +Also we implemented control over the parameters for cloning associations (you can read more [here](https://github.com/clowne-rb/clowne/issues/15)). Let's explain what the difference: ```ruby class UserCloner < Clowne::Cloner @@ -76,11 +73,11 @@ # Execute custom block with params and parent record as arguments trait :by_block_with_parent do include_association :profile, params: Proc.new do |params, user| { name: params[:profile][:name], - email: user.email + email: user.email, } end end end @@ -91,10 +88,10 @@ end # Execute: def get_profile_jsonb(user, trait) - params = { profile: { name: 'John', surname: 'Cena' } } + params = {profile: {name: "John", surname: "Cena"}} cloned = UserCloner.call(user, traits: trait, **params).to_record cloned.profile.jsonb_field end get_profile_jsonb(user, :default)