I am dealing with legacy code and do not have access to the database. There is a table which does not have a primary id column.
I can find a record using record = Model.find_or_initialize_by(listing_id: rating.pid, criteria_id: 33)
.
I can increment an attribute with record.rating_count += 1
but when I try to save it with record.save!
, it gives the error TypeError: nil is not a symbol nor a string
.
I think this is because record does not have a primary id (key) but I am not sure why it doesn't update the record.
If you have any suggestions, please let me know.