Rails ERD - Help with model

Hello i have some errors in generating ERD from models… I guess i have
wrong associations… please look at it

[DB]

orders

payment_address_id
delivery_address_id
user_id

products_orders

product_id
order_id

[MODELS]

Order

has_many :products_orders
has_many :products, :through => :products_orders
belongs_to :address, :foreign_key => :payment_address_id
belongs_to :address, :foreign_key => :delivery_address_id
belongs_to :user

products_orders

belongs_to :product
belongs_to :order

[rake erd]
Warning: Ignoring invalid association :products_orders on Order
(uninitialized constant Order::ProductsOrder)
Warning: Ignoring invalid association :products on Order (uninitialized
constant Order::ProductsOrder)
Warning: Ignoring invalid association :user on Order (uninitialized
constant Order::User)
Warning: Ignoring invalid association :products_orders on Product
(uninitialized constant Product::ProductsOrder)
Warning: Ignoring invalid association :orders on Product (uninitialized
constant Product::ProductsOrder)
what have i wrong ? Thank you

On Monday, June 10, 2013 4:39:16 AM UTC-4, Ruby-Forum.com User wrote:

user_id
has_many :products, :through => :products_orders
Warning: Ignoring invalid association :products_orders on Order


Posted via http://www.ruby-forum.com/.

You’ve deviated from the Rails conventions, which you can do, but then
you
have to tell ActiveRecord how to handle it. Rails expects model names
to
have a singular form, and table names to be the plural of that name.
For
example, if the table name is users, it expects a model named User. If
the model name is Product, it’s expecting the table name to be Products.

In your case, you’ve set up products_orders (the plural) as both the
model
name and the table name. It’s seeing the table name products_orders,
which
conforms to its expectations, and is expecting a model name
ProductsOrder
(the singular) which it can’t find.

Thank you it works now