I've followed the Railscast for migrating an application to Rails 4 and the transition to Strong Parameters. http://railscasts.com/episodes/415-upgrading-to-rails-4
I have my Create/New methods working fine. But, I'm having problems when I try to update a record. I keep getting the following message:
ArgumentError in CustomersController#update Unknown key: first_name
I've looked at various posts here on Stack Overflow and also generated a new Rails 4 app to verify that I'm doing things correctly. I'm obviously missing something.
Here is my Controller code for the update method:
def update
@customer = Customer.find(customer_params)
respond_to do |format|
if @customer.update(customer_params)
format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @customer.errors, status: :unprocessable_entity }
end
end
end
Here is where I'm setting up my strong parameters:
private
def set_customer
@customer = Customer.find(params[:id])
end
def customer_params
params.require(:customer).permit(:first_name, :middle_initial, :last_name, :address1, :address2, :city, :state, :zip, :phone, :gender, :email, :membership_id, :date_of_birth)
end
Any assistance is greatly appreciated.