docs/parameters.md in clowne-1.2.0 vs docs/parameters.md in clowne-1.3.0
- old
+ new
@@ -6,11 +6,11 @@
```ruby
class UserCloner < Clowne::Cloner
include_association :posts, ->(params) { where(state: params[:state]) }
- finalize do |_source, record, params|
+ finalize do |_source, record, **params|
record.email = params[:email]
end
end
operation = UserCloner.call(user, state: :draft, email: "cloned@example.com")
@@ -25,11 +25,11 @@
As result we strongly recommend to use ruby keyword arguments instead of params hash:
```ruby
# Bad
-finalize do |_source, record, params|
+finalize do |_source, record, **params|
record.email = params[:email]
end
# Good
finalize do |_source, record, email:, **|
@@ -80,10 +80,10 @@
end
end
end
class ProfileCloner < Clowne::Cloner
- finalize do |_source, record, params|
+ finalize do |_source, record, **params|
record.jsonb_field = params
end
end
# Execute: