Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created March 17, 2009 02:38
Show Gist options
  • Save ukstudio/80241 to your computer and use it in GitHub Desktop.
Save ukstudio/80241 to your computer and use it in GitHub Desktop.
#
# 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