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.
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
CONTROLLER: @vehicles = Vehicle.find_all_active
VIEW: <%= vehicle.deliveries.length %>
The error... undefined method `table_name' for Delivery:Class
Notes... The problem seems to be the class method find_all_active. I tested the equivalent calls in the console and they work fine - so why not when the application is running?
Any comments appreciated