Compare commits
No commits in common. "81040a3413526b9768be9e01a83f106099767a32" and "ac824fb5edf2c765e2c0e3311f79b763bd0a3362" have entirely different histories.
81040a3413
...
ac824fb5ed
|
@ -460,7 +460,6 @@ class SeminarMain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def clone_new_for_object(object,clone_target=nil,clone_mode=false)
|
def clone_new_for_object(object,clone_target=nil,clone_mode=false)
|
||||||
@except_clone_relations ||= self.except_clone_relations
|
|
||||||
if clone_mode
|
if clone_mode
|
||||||
new_object = object
|
new_object = object
|
||||||
clone_target = object.class.find(object.copy_id) rescue nil if clone_target.nil?
|
clone_target = object.class.find(object.copy_id) rescue nil if clone_target.nil?
|
||||||
|
@ -468,7 +467,7 @@ class SeminarMain
|
||||||
clone_target = object if clone_target.nil?
|
clone_target = object if clone_target.nil?
|
||||||
new_object = object.dup
|
new_object = object.dup
|
||||||
end
|
end
|
||||||
return if @except_clone_relations.to_s.include?(new_object.class.to_s.underscore)
|
return if self.except_clone_relations.to_s.include?(new_object.class.to_s.underscore)
|
||||||
@records_all["#{new_object.class.to_s.underscore.singularize}_ids"] = {} if @records_all["#{new_object.class.to_s.underscore.singularize}_ids"].nil?
|
@records_all["#{new_object.class.to_s.underscore.singularize}_ids"] = {} if @records_all["#{new_object.class.to_s.underscore.singularize}_ids"].nil?
|
||||||
begin
|
begin
|
||||||
@records_all["#{new_object.class.to_s.underscore.singularize}_ids"][clone_target.id] = object.id
|
@records_all["#{new_object.class.to_s.underscore.singularize}_ids"][clone_target.id] = object.id
|
||||||
|
@ -586,7 +585,7 @@ class SeminarMain
|
||||||
new_object.send("#{f}_id=",(@records_all["#{f}_ids"][clone_target.send("#{f}_id")]))
|
new_object.send("#{f}_id=",(@records_all["#{f}_ids"][clone_target.send("#{f}_id")]))
|
||||||
end
|
end
|
||||||
elsif clone_target.relations[f].macro == :has_one
|
elsif clone_target.relations[f].macro == :has_one
|
||||||
next if @except_clone_relations.to_s.include?(f)
|
next if self.except_clone_relations.to_s.include?(f)
|
||||||
need_clone_relation = clone_target.send(f)
|
need_clone_relation = clone_target.send(f)
|
||||||
clone_relation = new_object.send(f)
|
clone_relation = new_object.send(f)
|
||||||
clone_relation, need_clone_relation = clone_new_for_object(need_clone_relation.dup, need_clone_relation, true) if clone_relation.nil?
|
clone_relation, need_clone_relation = clone_new_for_object(need_clone_relation.dup, need_clone_relation, true) if clone_relation.nil?
|
||||||
|
@ -612,7 +611,7 @@ class SeminarMain
|
||||||
end
|
end
|
||||||
new_object.send("#{f}=",clone_relation)
|
new_object.send("#{f}=",clone_relation)
|
||||||
elsif clone_target.relations[f].macro == :has_many || clone_target.relations[f].macro == :has_and_belongs_to_many
|
elsif clone_target.relations[f].macro == :has_many || clone_target.relations[f].macro == :has_and_belongs_to_many
|
||||||
next if @except_clone_relations.to_s.include?(f)
|
next if self.except_clone_relations.to_s.include?(f)
|
||||||
clone_relations = []
|
clone_relations = []
|
||||||
need_clone_relations = clone_target.send(f).asc(:_id).to_a
|
need_clone_relations = clone_target.send(f).asc(:_id).to_a
|
||||||
file_flag = false
|
file_flag = false
|
||||||
|
|
Loading…
Reference in New Issue