From: Michal Fojtik <mfoj...@redhat.com> This patch add URL helpers for all Rabbit subcollections, like:
system_volumes(:id => system_id) => "http://localhost:3001/cimi/systems/system_id/volumes" system_volumes(:id => system_id, :ent_id => volume_id) => "http://localhost:3001/cimi/systems/system_id/volumes/volume_id" Signed-off-by: Michal fojtik <mfoj...@redhat.com> --- server/lib/deltacloud/helpers/rabbit_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/lib/deltacloud/helpers/rabbit_helper.rb b/server/lib/deltacloud/helpers/rabbit_helper.rb index a8ae4f5..b249dc6 100644 --- a/server/lib/deltacloud/helpers/rabbit_helper.rb +++ b/server/lib/deltacloud/helpers/rabbit_helper.rb @@ -45,6 +45,7 @@ module Sinatra::Rabbit c.operations.each do |operation| URLHelper.instance_eval(&generate_url_helper_for(c, operation)[0]) end + URLFor(c.collections) end URLHelper end @@ -53,6 +54,10 @@ module Sinatra::Rabbit operation_name = operation.operation_name.to_s collection_name = collection.collection_name.to_s + if collection.subcollection? + collection_name = "#{collection.parent_collection.collection_name.to_s.singularize}_#{collection_name}" + end + # Construct OPERATION_COLLECTION_URL helper # The :index and :create operation does not get any prefix # -- 1.8.1.4