GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
issue redirect in controller; test of same
automatthew (author)
Thu May 15 13:28:57 -0700 2008
commit  b57612786f085f1aa1270c00412441e73dcd1998
tree    e968b30e4869b7b81fba5634f56edb1233549f6d
parent  32beed3d7420fd1bf9d9428217a8f6daf980255c
...
66
67
68
69
70
 
 
 
 
71
72
73
...
66
67
68
 
 
69
70
71
72
73
74
75
0
@@ -66,8 +66,10 @@ module Waves
0
             # create a new resource for the given model
0
             path %r{^/#{model}/?$}, :method => :post do | model |
0
               resource( model.singular ) do
0
- instance = controller { create }
0
- redirect( "/#{model.singular}/#{instance.name}/editor" )
0
+ controller do
0
+ instance = create
0
+ redirect( "/#{model_name}/#{instance.name}/editor" )
0
+ end
0
               end
0
             end
0
 
...
29
30
31
 
 
 
 
 
 
32
33
34
35
36
 
 
 
 
37
38
39
...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
0
@@ -29,11 +29,21 @@ specification "A developer may succinctly define a resource-based controller-vie
0
     path('/cow' ) do
0
       resource( :animal ) { controller { cow } | view { | says | say( says ) } }
0
     end
0
+
0
+ path('/onager') do
0
+ resource( "cow" ) do
0
+ controller { redirect model_name }.call
0
+ end
0
+ end
0
   end
0
 
0
   specify 'Pipe output of controller to view within a resource context.' do
0
     get('/cow').body.should == "This animal says: 'Moo!'"
0
   end
0
+
0
+ specify "Redirect from within controller" do
0
+ get('/onager').status.should == 302
0
+ end
0
 
0
 
0
 end

Comments

    No one has commented yet.