param is missing or the value is empty nested require permit
Error: param is missing or the value is empty: home_address_attributes
Before (wrong)
private
def user_params
Rails.logger.info("PARAMS: #{params.inspect}")
params.require(:user).permit(:fullname, :login, :password, :password_confirmation, :phone_home, :phone_work, :phone_cell, :deliveryNote, :home_address_attributes).require(:home_address_attributes)
end
After (good)
private
def user_params
Rails.logger.info("PARAMS: #{params.inspect}")
params.require(:user).permit(:fullname, :login, :password, :password_confirmation, :phone_home, :phone_work, :phone_cell, :deliveryNote,
{ home_address_attributes: [ :line1, :line2, :country, :zipCode, :province, :city ] })
end
The documentation is there http://api.rubyonrails.org/classes/ActionController/Parameters.html#method-i-require
Recent Comments