是什么引起此ActiveRecord :: ReadOnlyRecord错误?
在此之前的问题得到了解答。我实际上发现我可以从该查询中删除联接,所以现在可以使用的查询是 start_cards = DeckCard.find :all, :joins => [:card], :conditions => ["deck_cards.deck_id = ? and cards.start_card = ?", @game.deck.id, true] 这似乎起作用。但是,当我尝试将这些DeckCard移动到另一个关联中时,出现ActiveRecord :: ReadOnlyRecord错误。 这是代码 for player in @game.players player.tableau = Tableau.new start_card = start_cards.pop start_card.draw_pile = false player.tableau.deck_cards << start_card # the error occurs on this line end 和相关的模型(Tableau是桌上的玩家卡片) class Player …