I am trying to make a inventory system, my table has the index “id” by default as primary key. My inventory number should be unique value to create new entry in the table, if the inventory already exists then it shall update the attributes. How do do this? By making inventory number as primary key? or is there any way to check and update an inventory already exists?
Share
This worked: create_or_update method in rails