In my table, primary key (my_id) is a string (combination of letters and numbers) and 'id' is a numeric column. Since rails 5 doesn't allow attr_accessible
, I added the private method to controller params.require(:model_name).permit(:list_of_attributes)
.
Now when I try to add a new record to this table, "id" takes the value of "my_id" (primary key). I was expecting "id" to be an increment number but this behavior started after removing attr_accessible.
Has anyone faced this issue?
@model.attributes["id"] this worked.