public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Click here to lend your support to: mack and make a donation at www.pledgie.com !
Namespaced resourced routes, such as Admin::UserController, now work.
markbates (author)
Wed Apr 23 07:55:24 -0700 2008
commit  1e9b6d4caa8e35382872b483368f7dfbc7665fb7
tree    345bd8c4adaf1d4a96fec07b49aeb9da5e668753
parent  4a2c59a0788b97cd90e1cc54995ea530d74f8673
...
 
1
2
3
...
1
2
3
4
0
@@ -1,3 +1,4 @@
0
+* Namespaced resourced routes, such as Admin::UserController, now work.
0
 * Added rake generator:list task to list all the available generators.
0
 * scaffold generator now creates a stub functional test.
0
 * model generator now creates a stub unit test.
...
78
79
80
81
 
 
 
 
 
 
 
 
 
 
 
82
83
84
...
78
79
80
 
81
82
83
84
85
86
87
88
89
90
91
92
93
94
0
@@ -78,7 +78,17 @@ unless Object.const_defined?("MACK_INITIALIZED")
0
   
0
   # require 'app' files:
0
   Dir.glob(File.join(MACK_APP, "**/*.rb")).each do |d|
0
- require d
0
+ begin
0
+ require d
0
+ rescue NameError => e
0
+ mod = e.message.gsub("uninitialized constant ", "")
0
+ x =%{
0
+ module ::#{mod}
0
+ end
0
+ }
0
+ eval(x)
0
+ require d
0
+ end
0
   end
0
   
0
   # require 'lib' files:
...
206
207
208
 
209
210
211
...
206
207
208
209
210
211
212
0
@@ -206,6 +206,7 @@ module Mack
0
       
0
       private
0
       def connect_with_named_route(n_route, pattern, options = {})
0
+ n_route = n_route.methodize
0
         route = connect(pattern, options)
0
         
0
         url = %{
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 Mack::Routes.build do |r|
0
 
0
+ r.resource "admin/users"
0
+
0
   r.connect "/", :controller => :tst_home_page
0
   r.connect "foo", :controller => :tst_home_page, :action => :foo
0
   r.pickles "/pickles", :controller => :tst_another, :action => :foo, :method => :post
...
30
31
32
 
 
 
 
 
33
34
35
...
30
31
32
33
34
35
36
37
38
39
40
0
@@ -30,6 +30,11 @@ class ControllerBaseTest < Test::Unit::TestCase
0
     r.on_disk_wants_x "/odw_x", :controller => "controller_base_test/wants_test", :action => :on_disk_wants, :format => :xml
0
   end
0
   
0
+ def test_admin_index
0
+ get admin_users_index_url
0
+ assert_match "Hello from Admin::UsersController", response.body
0
+ end
0
+
0
   def test_format_on_route_definition_sets_initial_format
0
     get on_disk_wants_x_url
0
     assert_match "<greeting>Hello World</greeting>", response.body

Comments

    No one has commented yet.