Forked from Killavus/before_removing_callbacks_controller.rb
Created
May 4, 2016 12:01
-
-
Save kivanio/41372c82d16a1e6d58cab027db270129 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomersController < ApplicationController | |
# … | |
def create | |
@customer = Customer.new(customer_params) | |
respond_to do |format| | |
if @customer.save | |
format.html { redirect_to @customer, | |
notice: 'Customer was successfully created.' } | |
format.json { render :show, status: :created, | |
location: @customer } | |
else | |
format.html { render :new } | |
format.json { render json: @customer.errors, | |
status: :unprocessable_entity } | |
end | |
end | |
end | |
# … | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment