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
samples/blog rewritten
automatthew (author)
Fri Sep 05 15:18:42 -0700 2008
commit  ac7cba19623e59b94fb9e1b6e8e5a0fad96e8756
tree    af3e49fd0f9194907d561555ecac8df2827c632d
parent  d2f4e06a80ab9cd883b33cf2115b33f4c2410765
...
4
5
6
7
 
8
9
 
10
11
12
...
4
5
6
 
7
8
 
9
10
11
12
0
@@ -4,9 +4,9 @@ module Blog
0
       
0
       resources do
0
         
0
- mount :entry, [ 'entry' ]
0
+ mount :entry, :path => [ 'entry' ]
0
         mount :entry, [ 'entry', { :rest => true } ]
0
-
0
+
0
       end
0
       
0
     end
...
20
21
22
23
24
 
25
26
27
 
 
 
 
 
 
28
29
30
...
20
21
22
 
 
23
24
25
 
26
27
28
29
30
31
32
33
34
0
@@ -20,11 +20,15 @@ module Blog
0
       end
0
       
0
       on :post, :create => [ ] do
0
- i = controller.create
0
- redirect "/entry/#{i.name}/edit"
0
+ redirect "/entry/#{controller.create.name}/edit"
0
       end
0
       
0
-
0
+ on :post, :comment => [ :name ] do
0
+ entry = controller.find( query.name )
0
+ comment = Models::Comment.create( query.comment.to_hash )
0
+ entry.add_comment( comment )
0
+ redirect request.path
0
+ end
0
       
0
     end
0
   end
...
1
 
2
3
4
...
8
9
10
 
...
 
1
2
3
4
...
8
9
10
11
0
@@ -1,4 +1,4 @@
0
-form :action => "/comments", :method => 'POST' do
0
+form :action => request.path, :method => 'POST' do
0
   input :type => :hidden, :name => 'comment.entry_id', :value => @entry.id
0
   label 'Name'; br
0
   input :type => :text, :name => 'comment.name'; br
0
@@ -8,3 +8,4 @@ form :action => "/comments", :method => 'POST' do
0
   textarea :name => 'comment.content', :rows => 10, :cols => 80; br
0
   input :type => :submit, :value => 'Save'
0
 end
0
+

Comments

    No one has commented yet.