public
Rubygem
Description: JSON Web App Framework
Homepage: http://halcyon.rubyforge.org/
Clone URL: git://github.com/mtodd/halcyon.git
Click here to lend your support to: halcyon and make a donation at www.pledgie.com !
Updated URL generator to follow the new design. Specs fail at 
extract_options_from_args! but this may be resolved with the next push of 
changes to the 0.9.8 Router changes.
mtodd (author)
Wed Sep 24 22:27:34 -0700 2008
commit  59b183e39445832c81ded4e02b9aceca4aa94c30
tree    707d85a8d85205a066112826b2ba90297c4e9676
parent  f37a8f71a3ae728e97b4a5bf36b06a00bbd35929
...
98
99
100
101
 
102
103
104
105
106
107
108
 
 
 
 
 
 
 
 
 
 
 
109
110
111
...
98
99
100
 
101
102
 
 
 
 
 
 
103
104
105
106
107
108
109
110
111
112
113
114
115
116
0
@@ -98,14 +98,19 @@ module Halcyon
0
     #  url(:admin_permissons) # => "/admin/permissions"
0
     #  url(:user, @user) # => "/users/1"
0
     #
0
-    # Based on the identical method of Merb's controller.
0
+    # Based on the +generate_url+ method of Merb's controller.
0
     # 
0
-    def url(name, rparams={})
0
-      Halcyon::Application::Router.generate(name, rparams,
0
-        { :controller => controller_name,
0
-          :action => method
0
-        }
0
-      )
0
+    def url(name, *args)
0
+      unless Symbol === name
0
+        args.unshift(name)
0
+        name = :default
0
+      end
0
+      
0
+      unless route = Halcyon::Application::Router.named_routes[name]
0
+        raise ArgumentError.new("Named route #{name.inspect} not found")
0
+      end
0
+      
0
+      route.generate(args, {:controller => controller_name, :action => method})
0
     end
0
     
0
     #--

Comments