I have Lineup and Piece models joined by piece_lineup model (has many through). I added a ‘status’ column to the piece_lineup model but i can’t figure out how to reference that attribute and/or change it. When listing the pieces associated with a lineup, I also want to list the status of the piece as it relates to the lineup. How do I do that?
I have Lineup and Piece models joined by piece_lineup model (has many through). I
Share
It’s very simple to get this column. Add to your model:
If you have to change this value, you should create
Lineup#status_for_piece=(piece, status)(as example) method. Find necessary row and update status.Inserting is not elegant way, but join table is not a good place for frequently updated data at all