Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kivanio/41372c82d16a1e6d58cab027db270129 to your computer and use it in GitHub Desktop.
Save kivanio/41372c82d16a1e6d58cab027db270129 to your computer and use it in GitHub Desktop.
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