Sha256: d604661bb93b6aba58fc8df2b535e1f97a398ef53429b47716d6a68635eb9401
Contents?: true
Size: 708 Bytes
Versions: 8
Compression:
Stored size: 708 Bytes
Contents
module EntryDeletion include Chanko::Unit scope(:view) do function(:delete_link) do render "/delete_link", :entry => entry if entry.persisted? end end scope(:controller) do function(:destroy) do entry = Entry.find(params[:id]) entry.unit.soft_delete redirect_to entries_path end function(:index) do @entries = Entry.unit.active end end models do expand(:Entry) do scope :active, lambda { where(:deleted_at => nil) } def soft_delete update_attributes(:deleted_at => Time.now) end end end helpers do def link_to_deletion(entry) link_to "Delete", entry, :method => :delete end end end
Version data entries
8 entries across 8 versions & 1 rubygems