We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ 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
automatthew (author)
Fri Sep 05 15:18:42 -0700 2008
commit  ac7cba19623e59b94fb9e1b6e8e5a0fad96e8756
tree    af3e49fd0f9194907d561555ecac8df2827c632d
parent  d2f4e06a80ab9cd883b33cf2115b33f4c2410765
waves / samples / blog / resources / entry.rb
100644 36 lines (28 sloc) 0.894 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Blog
  module Resources
    class Entry < Default
      
      on :get, :list => [ ] do
        view.list( plural => controller.all )
      end
 
      on :get, :show => [ :name ] do
        view.show( singular => controller.find( query.name ) )
      end
      
      on :get, :edit => [ :name, 'edit' ] do
        view.edit( singular => controller.find( query.name ) )
      end
      
      on :put, :update => [ :name ] do
        controller.update( query.name )
        redirect "/entry/#{query.name}"
      end
      
      on :post, :create => [ ] do
        redirect "/entry/#{controller.create.name}/edit"
      end
      
      on :post, :comment => [ :name ] do
        entry = controller.find( query.name )
        comment = Models::Comment.create( query.comment.to_hash )
        entry.add_comment( comment )
        redirect request.path
      end
      
    end
  end
end