lib/can_be/processor/instance.rb in can_be-0.3.0 vs lib/can_be/processor/instance.rb in can_be-0.4.0
- old
+ new
@@ -88,10 +88,14 @@
def destroy_history(details_type)
history_model_class.where(can_be_model_id: @model.id, can_be_details_type: details_type).destroy_all
end
+ def destroy_details
+ @model.send(@details_name).destroy
+ end
+
private
def has_details?
@model.respond_to?(@details_name) && @model.respond_to?(@details_id) && @model.respond_to?(@details_type)
end
@@ -103,11 +107,10 @@
set_history_details_for(t)
else
@model.send("#{@details_name}=", details_for(t))
end
else
- @model.send("#{@details_id}=", nil)
- @model.send("#{@details_type}=", nil)
+ @model.send("#{@details_name}=", nil)
end
end
def destroy_details_history(histories)
histories.each do |h|