deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@redhat.com
Subject [PATCH 2/9] CIMI: Added ref_id helper to Base class
Date Fri, 22 Feb 2013 23:52:25 GMT
From: Michal Fojtik <mfojtik@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 <mfojtik@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


Mime
View raw message