app/models/concerns/deep_cloning.rb in iqvoc-4.11.1 vs app/models/concerns/deep_cloning.rb in iqvoc-4.12.0

- old
+ new

@@ -13,13 +13,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'active_support/concern' +require 'active_record/model_schema' module DeepCloning extend ActiveSupport::Concern + extend ActiveRecord::ModelSchema included do #:nodoc: alias_method_chain :dup, :deep_cloning end @@ -52,10 +54,10 @@ def dup_with_deep_cloning(options = {}) kopy = dup_without_deep_cloning if options[:except] Array(options[:except]).each do |attribute| - kopy.write_attribute(attribute, attributes_from_column_definition[attribute.to_s]) + kopy.send("#{attribute}=", kopy.class.column_defaults[attribute.to_s]) end end if options[:include_association] Array(options[:include_association]).each do |association_attribute|