I was hoping somebody might point me in the right direction. I have a class Ad that has a number of different placements on a website. It has_many_polymorphs :placements, :from => [:categories, :products, :pages, :menu_items], giving me the ability to have an ad show up on a number of different models - all of this works great!
I'd like to use two more attributes on each ad - one is position for acts_as_list, and the other is location which would just be a string. I have set up the placements table with these two new fields, but I can't figure out how to extend the Ad class to include these join attributes so I can refer to these attributes when I call for child_class.ads.first.position for instance. I think I'm supposed to be using :parent_extend to assign the joined attrs to the Ad model when a child references it. Any help?
I was hoping somebody might point me in the right direction. I have a class Ad that has a number of different placements on a website. It has_many_polymorphs :placements, :from => [:categories, :products, :pages, :menu_items], giving me the ability to have an ad show up on a number of different models - all of this works great!
I'd like to use two more attributes on each ad - one is position for acts_as_list, and the other is location which would just be a string. I have set up the placements table with these two new fields, but I can't figure out how to extend the Ad class to include these join attributes so I can refer to these attributes when I call for child_class.ads.first.position for instance. I think I'm supposed to be using :parent_extend to assign the joined attrs to the Ad model when a child references it. Any help?