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>
---
 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..52b9082 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
+    end
+
     private
 
     # Load an existing database entity for this object, or create a new one
-- 
1.8.1.2

Reply via email to