From 9e723519982c3b442aa90f3728bfddd4025d4a69 Mon Sep 17 00:00:00 2001 From: spag Date: Fri, 8 Feb 2013 10:41:18 +0100 Subject: softkey-call_forward relation polymorphic --- lib/tasks/gs_cluster.rake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/tasks/gs_cluster.rake b/lib/tasks/gs_cluster.rake index 7b49ebb..c248c32 100644 --- a/lib/tasks/gs_cluster.rake +++ b/lib/tasks/gs_cluster.rake @@ -201,10 +201,14 @@ namespace :gs_cluster do remote_objects(remote_site, local_node_id, last_sync, Softkey).each do |remote_object| attributes = make_hash(remote_object.attributes) attributes[:sip_account_id] = SipAccount.where(:uuid => attributes[:sip_account_uuid]).first.try(:id) - attributes[:call_forward_id] = CallForward.where(:uuid => attributes[:call_forward_uuid]).first.try(:id) + + if ! attributes[:softkeyable_uuid].blank? + attributes[:softkeyable_id] = attributes[:softkeyable_type].constantize.where(:uuid => attributes[:softkeyable_uuid]).first.try(:id) + end + attributes[:softkey_function_id] = SoftkeyFunction.where(:name => attributes[:function]).first.try(:id) attributes.delete(:sip_account_uuid) - attributes.delete(:call_forward_uuid) + attributes.delete(:softkeyable_uuid) attributes.delete(:softkey_function) process_object(Softkey, Softkey, Softkey.where(:uuid => attributes[:uuid]).first, attributes) end -- cgit v1.2.3