nick.bell71-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2008-Jul-19 20:19 UTC
Undefined Method Errors
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 %>
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
Thanks
Nick
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---