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.

I can successfully display ALL of the experiments by advertiser with the
following iteration

<% @advertiser.experiments.each do |experiments| %>
 <td><%= experiments.id %></td>
 <td><%= experiments.name %></td>
<% end %>

Or I can successfully display all the experiment_type with the following
iteration

<% @aov.each do |experiments| %>
 <td><%= experiments.id %></td>
 <td><%= experiments.name %></td>
<% end %>

What I cannot figure out is how to show the experiment_type by
advertiser. I thought something like

<% @advertiser.aov.each do |experiments| %> would work, but it gives me
an undefined method `aov' for #<Advertiser:

Any help would be appreciated. Thanks in advance.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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+unsubscr...@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/037862d98369619e74cbea00fd7517d1%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to