find_by_sql in Rails, accessing the resulting array

后端 未结 5 1935
日久生厌
日久生厌 2020-12-30 17:09

I\'m trying to run a query in a very quick and dirty way in Rails, without putting the rest of the model in place. I know this is bad practice but I just need a quick resul

5条回答
  •  礼貌的吻别
    2020-12-30 17:38

    If not for you saying that you tried and failed accessing [0] i'ld say you want to put

    @item.shipping_price.first.price # I guess BSeven just forgot the .first. in his solution
    

    into the view...strange

提交回复
热议问题