Skip to content

Instantly share code, notes, and snippets.

@osiro
Created March 20, 2012 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osiro/2133486 to your computer and use it in GitHub Desktop.
Save osiro/2133486 to your computer and use it in GitHub Desktop.
when 'dui_charges'
@object.insurance_detail.drivers.each do |d|
@object.insurance_detail.dui_charges.build({:driver_id => d.id}) unless @object.insurance_detail.dui_charges.map{ |dc| dc.driver_id }.include?(d.id)
end
when 'dui_old_charges'
@object.insurance_detail.drivers.each do |d|
@object.insurance_detail.dui_old_charges.build({:driver_id => d.id}) unless @object.insurance_detail.dui_old_charges.map{ |doc| doc.driver_id }.include?(d.id)
end
when 'lost_licences'
@object.insurance_detail.drivers.each do |d|
@object.insurance_detail.lost_licences.build({:driver_id => d.id}) unless @object.insurance_detail.lost_licences.map{ |doc| doc.driver_id }.include?(d.id)
end
when 'old_lost_licences'
@object.insurance_detail.drivers.each do |d|
@object.insurance_detail.old_lost_licences.build({:driver_id => d.id}) unless @object.insurance_detail.old_lost_licences.map{ |doc| doc.driver_id }.include?(d.id)
end
when 'fault_claims'
@object.insurance_detail.drivers.each do |d|
@object.insurance_detail.fault_claims.build({:driver_id => d.id}) unless @object.insurance_detail.fault_claims.map{ |doc| doc.driver_id }.include?(d.id)
end
when 'old_fault_claims'
@object.insurance_detail.drivers.each do |d|
@object.insurance_detail.old_fault_claims.build({:driver_id => d.id}) unless @object.insurance_detail.old_fault_claims.map{ |doc| doc.driver_id }.include?(d.id)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment