code-and-effect / effective_addresses

Extend any ActiveRecord object to have one or more named addresses. Includes a geographic region aware custom form input backed by Carmen.
MIT License
22 stars 4 forks source link

Error when submitting form #23

Closed benjaminb10 closed 5 years ago

benjaminb10 commented 5 years ago

Hi, when I submit form, I always have this errors:

2 errors prohibited this order from being saved: Addresses addressable must exist Billing address is invalid

In my view: <%= effective_address_fields(form, :billing_address, :field_order => [:country_code, :full_name, :address1, :address2, :city, :state_code, :postal_code]) %>

In my controller I've add accept_params as the documentation In my model I've acts_as_addressable :billing

Any clue?

benjaminb10 commented 5 years ago

Do I have to add a foreign_key to my Model?

matt-riemer commented 5 years ago

No, you shouldn't have to add any foreign_keys...

Can I see a snippet of your model and your form?

If you stopped and did binding.pry in your view somewhere, after the form saved but came back with errors, what's your f.object.errors look like?

Try to simplify! I feel like there must be something in your base model invalid somewhere

matt-riemer commented 5 years ago

Are there any unpermitted params?