19 Jul 22:22
undefined method `table_name'
From: nick.bell71@... <nick.bell71@...>
Subject: undefined method `table_name'
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-07-19 20:26:18 GMT
Subject: undefined method `table_name'
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-07-19 20:26:18 GMT
Hi I'm relative new to RoR - but I'm having a problem with some model relationships that I thought should have worked. Hope someone can help. The code... MODELS: class Delivery < ActiveRecord::Base belongs_to :vehicle end class Vehicle < ActiveRecord::Base has_many :deliveries def self.find_all_active Vehicle.find(:all, :order => 'name', :conditions => ['is_active = ?', true]) end end CONTROLLER: @vehicles = Vehicle.find_all_active VIEW: <%= vehicle.deliveries.length %>(Continue reading)
RSS Feed