On 6 April 2011 04:06, Jason <[email protected]> wrote:
> I'm trying to create a simple POS (Point of Sale) system using rails
> 3, ruby 1.8.7
>
> I have associations set up in the order models to the items and seats
> (tables)
>
> CODE
> ####################
> class Order < ActiveRecord::Base
>    has_many :order_splits
>    has_many :order_split_items, :through => :order_splits
>
>    #order.table_id associates to seat.id
>    belongs_to :seat, :foreign_key => 'table_id'
> end
>
> class OrderSplit < ActiveRecord::Base
>    belongs_to :order
>    belongs_to :order_split_item
> end
>
> class OrderSplitItem < ActiveRecord::Base
>    belongs_to :items

That should be has_many, not belongs_to  (or it is wrong in Item below).

Colin

>    has_many :order_splits
>    has_many :orders, :through => :order_splits
> end
>
> class Seat < ActiveRecord::Base
>    has_many :orders
> end
>
> class Item < ActiveRecord::Base
>    belongs_to :item_category
>    belongs_to :order_split_item
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to