Created
December 17, 2009 22:22
-
-
Save wfarr/259079 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get '/posts/:id/edit' do | |
| @post = Post.find(params[:id]) | |
| haml :"posts/edit" | |
| end | |
| put '/posts/:id' do | |
| @post = Post.find(params[:id]) | |
| @post.update_attributes(params) | |
| cleanup @post | |
| redirect "/posts/#{@post.id}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %form{:action => "/posts/#{@post.id}", :method => 'post'} | |
| %input{:type => 'hidden', :name => '_method', :value => 'put'} | |
| %p | |
| %label{:for => 'title'}Title: | |
| %input{:name => 'title', :id => 'title', :value => @post.title} | |
| %p | |
| %label{:for => 'tags_list'}Tags: | |
| %input{:name => 'tags_list', :id => 'tags_list', :value => @post.tags_list} | |
| %p | |
| %label{:for => 'body'}Body: | |
| %br/ | |
| = find_and_preserve do | |
| %textarea{:name => 'body', :id => 'body', :rows => '12', :cols => '40'}= @post.body | |
| %p | |
| %input{:type => 'submit'} | |
| %a{:href => "/posts/#{@post.id}"} Back |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment