Module: ActiveRecordCloning
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rails_core_extensions/active_record_cloning.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#clone_excluding(excludes = []) ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/rails_core_extensions/active_record_cloning.rb', line 59 def clone_excluding(excludes=[]) method = ActiveRecord::Base.instance_methods(false).include?(:clone) ? :clone : :dup cloned = send(method) excludes ||= [] excludes = [excludes] unless excludes.is_a?(Enumerable) self.class.exclude_attributes(cloned, excludes) cloned end |