Module: Para::Cloneable::ClassMethods
- Defined in:
- lib/para/cloneable.rb
Instance Method Summary collapse
-
#acts_as_cloneable(*args) ⇒ Object
Allow configuring cloneable options for the model, and making the model cloneable in the admin.
- #cloneable? ⇒ Boolean
Instance Method Details
#acts_as_cloneable(*args) ⇒ Object
Allow configuring cloneable options for the model, and making the model cloneable in the admin
The provided arguments are the cloneable associations for the model, and keyword arguments are passed to the #deep_clone method.
An optional :prepare keyword argument can be passed and will be called by #deep_clone to allow altering the cloned resource before saving it.
47 48 49 50 51 52 53 54 55 |
# File 'lib/para/cloneable.rb', line 47 def acts_as_cloneable(*args) @cloneable = true = args. self. = .reverse_merge({ include: args }) end |
#cloneable? ⇒ Boolean
57 58 59 |
# File 'lib/para/cloneable.rb', line 57 def cloneable? @cloneable ||= false end |