From: Michal Fojtik <mfoj...@redhat.com>

The ref_id(url) will extract the last segment of the
URL and return it as an 'id'.

FIXME: We should use ctx to return the ID of resource properly.

Signed-off-by: Michal fojtik <mfoj...@redhat.com>
TrackedAt: 
http://tracker.deltacloud.org/patch/90eb17744273b3e64b01808f7692fe57c4cff097
---
 server/lib/cimi/models/base.rb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
index 2e3351d..e7fd358 100644
--- a/server/lib/cimi/models/base.rb
+++ b/server/lib/cimi/models/base.rb
@@ -165,6 +165,10 @@ module CIMI::Model
       property.merge!(h)
     end
 
+    def ref_id(ref_url)
+      ref_url.split('/').last if ref_url
+    end
+
     private
 
     # Load an existing database entity for this object, or create a new one
-- 
1.8.1.2

Reply via email to