Invalid source reflection macro :has_many :through

前端 未结 3 1279
野性不改
野性不改 2021-01-21 14:08

I have such angry associations: financings >- events >- subprograms >- programs. I want to get acces to last_financings from programs through all of them so code is:

<         


        
3条回答
  •  别那么骄傲
    2021-01-21 14:52

    This seems like a really awkward way of doing this... I'd rather make a virtual accessor in Program that calls something like this:

    self.subprograms.first.events.first.financings.first(:order => 'date DESC')
    

提交回复
热议问题