On 1 March 2012 23:03, Brandon Might <might.brandon@gmail.com> wrote:
> My models:
>
> class Product < ActiveRecord::Base
>
>
> has_many :Orders_Products
That should be :orders_products all lower case, so matching the table
name. The same applies to all later relationships.
Colin
> has_many :Orders, through: :Orders_Products
> end
>
> class OrdersProduct < ActiveRecord::Base
>
>
> belongs_to: Order
> belongs_to: Product
> end
>
> class Order < ActiveRecord::Base
> has_many :Order_Products
> has_many :Products, through: :Orders_Products
>
>
> end
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment