On Fri, Jul 1, 2016 at 6:52 AM, Scott Le gendre <lists@ruby-forum.com> wrote:
> I have an advertiser model and an experiment model. I've setup the
> associations as follows:
>
> Advertiser has_many :experiments
> Experiment belongs_to :advertisers
>
> The experiments table has a column titled "experiment_type", which can
> either be AOV or Conversion. I am trying to display experiments for the
> particular advertiser by experiment_type.
It sounds like you wanted to do this:
http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yDhqW08StQ5bk9MSLOXthB1UQ_RXhkDLc7YcET8-5FRXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment