Permalink
Browse files

new: put new comment

  • Loading branch information...
1 parent 64f529f commit f9bb0ea5c5ca0a40c0b8bbf5f4f834051788882a @yhara committed Apr 20, 2009
Showing with 13 additions and 3 deletions.
  1. +10 −0 start.rb
  2. +3 −3 views/index.haml
View
@@ -17,3 +17,13 @@ class Comments < Sequel::Model
@comments = Comments.all
haml :index
end
+
+put '/comment' do
+ Comments.create({
+ :name => request[:name],
+ :title => request[:title],
+ :message => request[:message],
+ })
+
+ redirect '/'
+end
View
@@ -1,16 +1,16 @@
%hr
%form{:method => "POST", :action => '/comment'}
- %input{:type => "hidden", :value => "PUT"}
+ %input{:type => "hidden", :name => "_method", :value => "PUT"}
%table
%tr
%td 名前
%td
%input{:type => "text", :name => "name"}
%tr
- %td URL
+ %td タイトル
%td
- %input{:type => "text", :name => "url"}
+ %input{:type => "text", :name => "title"}
%tr
%td 内容
%td

0 comments on commit f9bb0ea

Please sign in to comment.