Colin, no, events and features have no relationship to each other (Eventfeatures are like features, but they are a separate object here). So:
Event has_many : evenfeatures and Eventfeature belongs_to: event Thanks! rvince On Tuesday, November 13, 2012 11:22:30 AM UTC-5, RVince wrote: > > I'm not sure how best to do this. I have a project that has Features > (these are video links) that go into a homepage. > It also has Events, which get displayed in a table, can be clicked on, and > a page about that event displays. > I'm working in an admin application for this site, a type of CMS system > whereby the administrator can put in different videos for the homepage, and > edit the events themselves. > > Ive been asked to add videos to the events. To do this, I am creating an > EventFeature object. Thusm when someone goes to edit an event's features, > it is not like editing features for the homepage. In an EventFeature, an > event_id is in place. My question then, how, in the erb for eventfeatures, > can I express things like: > > <% if @features any? %> > > which now are not just if there are any features, but any eventfeatures > with a specified event_id. How can I express that here? > > in other words > > <% if @eventfeatures any? %> > > Is not really what I want because i dont want all eventfeatures, only > those where eventfeatures.event_id==specific value. > > Similarly, how would you express: > > <$ @features.each do |feature| %> > > to be: > > <$ @eventfeatures.each do |eventfeature| %> > > only for those eventfeatures of a specific eventfeature.event_id > > TIA, rvince > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KAv1fwlpQVkJ. For more options, visit https://groups.google.com/groups/opt_out.