Topic: Totally stuck with 2 has_many/belongs_to associations
I have an application with 3 models
class Order < ActiveRecord::Base
class Event < ActiveRecord::Base
class User < ActiveRecord::Base
Both, the events and the users table have an order_id column as foreign key, both tables are populated with data which should give the results one should expect from this simple model.
Order.find(1).events gives me all events for the order with id 1. Works as advertised ;-)
Order.find(1).users gives me the following error
NoMethodError: undefined method `users' for #<Order:0x33d6ab4>
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/base.rb:1848:in `method_missing'
I'm totally stuck, has anybody an idea how to solve this problem.
Any help is appreciated
Thanks in advance
Last edited by DocTom (2007-01-29 18:34:16)