Trouble locating and displaying list of records from a relationship model in Rails app

前端 未结 3 602
终归单人心
终归单人心 2021-01-15 01:16

I have a relationship model that tracks customers (users) of shops in a has_many :through association. I\'m having trouble with my ShopsController

3条回答
  •  情话喂你
    2021-01-15 01:47

    ... for a given shop ...

    This suggests that you should be finding an instance of Shop, and from it using associations to retrieve the appropriate Users. I'd expect to see this in a shop-oriented view, not a relationship view, and for there to be an association on Shop of:

    has_many :users, through => :relationships
    

提交回复
热议问题