Created
March 17, 2009 02:38
-
-
Save ukstudio/80241 to your computer and use it in GitHub Desktop.
This file contains 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
# | |
# Railsで確認画面を実装するときのテンプレ | |
# | |
def confirm | |
if request.post? | |
@entry = Entry.new(params[:entry]) | |
else request.put? | |
@entry = Entry.find(params[:id]) | |
@entry.attributes = params[:entry] | |
end | |
if @entry.valid? | |
respond_to do |format| | |
format.html # confirm.html.erb | |
end | |
else | |
respond_to do |format| | |
format.html { render :action => (@entry.new_record? ? "new" : "edit") } | |
end | |
end | |
end | |
# routes | |
# | |
# | |
map.resouces( | |
:entrys, | |
:collection => { | |
:confirm => :post, | |
}, | |
:member => { | |
:confirm => :put, | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment