Difference Between find and Where with Relationships

前端 未结 3 1750
清歌不尽
清歌不尽 2021-01-05 17:51

I wouldn\'t think there is a difference when it comes to active record and finding data.

Here are my models

class User < ActiveRecord::Base
  has_         


        
3条回答
  •  鱼传尺愫
    2021-01-05 18:10

    The where is method that returns an array of objects. So, in your case try

    u.each { |user| user.shows }
    

提交回复
热议问题