Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using :parent_extend #13

Open
ghost opened this issue Jul 7, 2010 · 0 comments
Open

Using :parent_extend #13

ghost opened this issue Jul 7, 2010 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 7, 2010

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants