What is causing this ActiveRecord::ReadOnlyRecord error?

后端 未结 6 672
我寻月下人不归
我寻月下人不归 2020-12-07 08:18

This follows this prior question, which was answered. I actually discovered I could remove a join from that query, so now the working query is

start_cards =          


        
6条回答
  •  执笔经年
    2020-12-07 08:40

    Instead of find_by_sql, you can specify a :select on the finder and everything's happy again...

    start_cards = DeckCard.find :all, :select => 'deck_cards.*', :joins => [:card], :conditions => ["deck_cards.deck_id = ? and cards.start_card = ?", @game.deck.id, true]

提交回复
热议问题