Skip to content

Instantly share code, notes, and snippets.

@joseluistorres
Created July 31, 2013 13:54
Show Gist options
  • Save joseluistorres/6122177 to your computer and use it in GitHub Desktop.
Save joseluistorres/6122177 to your computer and use it in GitHub Desktop.
Scary Code
def restore_record
if params[:model] && params[:id]
begin
const_class = params[:model].upcase
a_record = const_class.constantize.send("only_deleted").send('find',params[:id])
a_record.recover
rescue Exception => e
logger.info "Restore error:#{e}"
end
end
redirect_to :back
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment