Second part of admin-namespace-reorder. Also renamed OrderGroup into Ordergroup. More view-sharing between groups is neccessary.

This commit is contained in:
Benjamin Meichsner 2009-01-14 12:46:01 +01:00
parent 2d5dc03b90
commit fadc951208
83 changed files with 410 additions and 518 deletions

View file

@ -1,10 +1,10 @@
# == Schema Information
# Schema version: 20090102171850
# Schema version: 20090114101610
#
# Table name: group_orders
#
# id :integer(4) not null, primary key
# order_group_id :integer(4) default(0), not null
# ordergroup_id :integer(4) default(0), not null
# order_id :integer(4) default(0), not null
# price :decimal(8, 2) default(0.0), not null
# lock_version :integer(4) default(0), not null
@ -12,21 +12,21 @@
# updated_by_user_id :integer(4) default(0), not null
#
# A GroupOrder represents an Order placed by an OrderGroup.
# A GroupOrder represents an Order placed by an Ordergroup.
class GroupOrder < ActiveRecord::Base
belongs_to :order
belongs_to :order_group
belongs_to :ordergroup
has_many :group_order_articles, :dependent => :destroy
has_many :order_articles, :through => :group_order_articles
has_many :group_order_article_results
belongs_to :updated_by, :class_name => "User", :foreign_key => "updated_by_user_id"
validates_presence_of :order_id
validates_presence_of :order_group_id
validates_presence_of :ordergroup_id
validates_presence_of :updated_by
validates_numericality_of :price
validates_uniqueness_of :order_group_id, :scope => :order_id # order groups can only order once per order
validates_uniqueness_of :ordergroup_id, :scope => :order_id # order groups can only order once per order
# Updates the "price" attribute.
# This will be the maximum value of a current order