Skip to content

Commit

Permalink
new: put new comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yhara committed Apr 20, 2009
1 parent 64f529f commit f9bb0ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions start.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ class Comments < Sequel::Model
@comments = Comments.all @comments = Comments.all
haml :index haml :index
end end

put '/comment' do
Comments.create({
:name => request[:name],
:title => request[:title],
:message => request[:message],
})

redirect '/'
end
6 changes: 3 additions & 3 deletions views/index.haml
Original file line number Original file line Diff line number Diff line change
@@ -1,16 +1,16 @@
%hr %hr


%form{:method => "POST", :action => '/comment'} %form{:method => "POST", :action => '/comment'}
%input{:type => "hidden", :value => "PUT"} %input{:type => "hidden", :name => "_method", :value => "PUT"}
%table %table
%tr %tr
%td 名前 %td 名前
%td %td
%input{:type => "text", :name => "name"} %input{:type => "text", :name => "name"}
%tr %tr
%td URL %td タイトル
%td %td
%input{:type => "text", :name => "url"} %input{:type => "text", :name => "title"}
%tr %tr
%td 内容 %td 内容
%td %td
Expand Down

0 comments on commit f9bb0ea

Please sign in to comment.