Good afternoon Vincent, I forked <https://github.com/vcolavin/forest/pull/1> your code and submitted a PR to get your tests passing. Happy coding!
Best, Tommy On Thursday, June 2, 2016 at 4:53:40 PM UTC-7, Vincent Colavin wrote: > > Hi! My friend Patrick (@mokolabs) suggested I post here. I'm a > Portland-based Ruby developer originally from San Diego. > > Here's a blog post I wrote recently detailing my question > <https://vcolavin.wordpress.com/2016/06/01/reverse-polymorphism-aka-polymorphic-join/>, > > but I'll rephrase it simply here. It's largely an ActiveRecord question. > > I want a model to have a has_many association to a model which has a > polymorphic association to several of other models. I've seen this called > "reverse polymorphism", but "polymorphic join" makes more sense to me. My > understanding is that if this is set up correctly, I could have what > *looks* like an object with a polymorphic has_many association, which is > something that AR doesn't have by default. > > This is the gist I followed to set up my associations > <https://gist.github.com/runemadsen/1242485>. > > Here are the relevant models in my work: > location.rb > <https://github.com/vcolavin/forest/blob/master/app/models/location.rb> > location_object.rb > <https://github.com/vcolavin/forest/blob/master/app/models/location_object.rb> > wolf.rb > <https://github.com/vcolavin/forest/blob/master/app/models/wolf.rb> > > The problem I'm encountering is that helper methods that ActiveRecord > usually provides (in this case, Location#objects) do not work. Is this > because ActiveRecord doesn't do that on its own, or am I doing something > else wrong? > > Thanks so much! > -- -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby --- You received this message because you are subscribed to the Google Groups "SD Ruby" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
