Skip to content

Instantly share code, notes, and snippets.

@elcontrastador
Last active October 10, 2017 06:51
Show Gist options
  • Save elcontrastador/0c5a8f4cc90e700afafd54f72b1da991 to your computer and use it in GitHub Desktop.
Save elcontrastador/0c5a8f4cc90e700afafd54f72b1da991 to your computer and use it in GitHub Desktop.
##### Client controller
before_action :set_client, only: [:show, :edit, :update, :destroy]
def destroy
@client.destroy
respond_to do |format|
format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_client
@client = Client.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def client_params
params.require(:client).permit(:full_name, :name, :abbrev, :domain_name)
end
##### Client for view code
<%= link_to "Delete", client_path(@client),
method: :delete,
data: {confirm: "You sure?"},
class: "btn btn-outline-danger m-btn m-btn--outline-2x ", id: "button_link" %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment