NOTE: i’ve previously posted it by mistake in test forum
I’ve got 2 tables (and models) - one with a product and second with
images of this product. How to create a single form (and controller)
that will insert/edit data to the product and also add links to images
table and add proper product_id? I’ve added “belongs_to :product” to
image model and “has_many :images” to product model.
How to connect these models, so if the user deletes a product all images
with corresponding product_id are deleted also?
Second thing - how to make a form field that user can just click a
button and choose a file rather than enter its path?
And the last thing - is mysql bool (or tinyint(1)) equivalent to
checkbox? So if i have bool field in a table and make a checkbox for it
in the form will it work?
Sorry if it was asked many times before, but the search option is
disabled now. If there was very similar question (here or on a web page)
you could just post a link.
Thanks in advance