Module: DeleteableActions

Included in:
MailManager::ContactsController
Defined in:
lib/deleteable.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



35
36
37
# File 'lib/deleteable.rb', line 35

def delete
  destroy
end

#destroyObject



39
40
41
42
43
# File 'lib/deleteable.rb', line 39

def destroy
  thing = controller_name.singularize.split('_').collect{|string| string.capitalize}.join.constantize.find(params[:id])
  thing.delete
  redirect_to(eval("#{controller_name}_path(derailed_params)"))
end

#undeleteObject



45
46
47
48
49
# File 'lib/deleteable.rb', line 45

def undelete
  thing = controller_name.singularize.split('_').collect{|string| string.capitalize}.join.constantize.find(:exclusive_scope,params[:id])
  thing.undelete
  redirect_to(eval("#{controller_name}_path(derailed_params)"))
end