For example, with a flea market app like Mercari, you need to create a column and give it an id in advance so that you can judge whether the product is in stock or sold out.
Let's assume that the inventory management column is used as the situation column, and id = 1 is assigned when the product is listed, and id = 0 is assigned when the product is sold out.
This hidden_field is useful when you want to give a specific id in advance at the time of registration.
Just add the following description to the form!
= f.hidden_field :situation, value: "1" #By specifying 1 in value, id when listing the item=1 is given
that's all
Recommended Posts