Revisions

gist: 8573 Download_button fork
public
Public Clone URL: git://gist.github.com/8573.git
Embed All Files: show embed
undo_in_flash_message.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
def destroy
  @foo = Foo.find(params[:id])
  @foo.update_attribute(:deleted_at, Time.now)
  flash.now[:notice] = "Foo has been deleted. <a href='#{undo_delete_message_path(@message)}'>Undo</a>"
end
 
def revert
  @foo = Foo.find(params[:id])
  @foo.update_attribute(:deleted_at, nil)
  ...
end