You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2013/02/23 00:52:25 UTC
[PATCH 2/9] CIMI: Added ref_id helper to Base class
From: Michal Fojtik <mf...@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 <mf...@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