ref: refs/heads/master
commit e2708af5e2358e90facd64771a71ead0e2db9324
Author: Klaus Kämpf
Date: Sat Sep 26 19:53:56 2009 +0200
Fix resource name (bnc#542169)
---
webservice/lib/resource_registration.rb | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/webservice/lib/resource_registration.rb b/webservice/lib/resource_registration.rb
index a2fb733..4330ee8 100644
--- a/webservice/lib/resource_registration.rb
+++ b/webservice/lib/resource_registration.rb
@@ -123,9 +123,6 @@ public
map.root :controller => "resources", :action => "index"
resources.each do |interface,implementations|
- qualifiers = interface.split "."
- name = qualifiers.pop
-
implementations.each do |implementation|
# url and controller are closely coupled
@@ -134,6 +131,7 @@ public
# the last one specifies the resource name and thus the controller name
#
namespaces = implementation[:controller].split "/"
+ name = namespaces[-1]
# the .namespace call affects the URI _and_ the controller path (!)
@@ -143,11 +141,11 @@ public
toplevel = ns
end
end
-
+ params = [ name, { :controller => namespaces.join("/"), :except => [ :new, :edit ] } ]
if implementation[:singular]
- toplevel.resource name, :controller => namespaces.join("/"), :except => [ :new, :edit ]
+ toplevel.resource *params
else
- toplevel.resources name, :except => [ :new, :edit ] do |mapping|
+ toplevel.resources *params do |mapping|
nested = implementation[:nested] and mapping.resources(nested)
end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org