continuing the refactor of the admin section
This commit is contained in:
@@ -2,4 +2,6 @@ class Administrator
|
||||
include SimplyStored::Couch
|
||||
include Devise::Orm::SimplyStored
|
||||
devise :database_authenticatable, :rememberable #, :recoverable, :rememberable, :trackable, :registerable
|
||||
|
||||
view :by_email, key: :email
|
||||
end
|
||||
|
||||
@@ -17,6 +17,8 @@ class List
|
||||
belongs_to :section
|
||||
has_and_belongs_to_many :users, storing_keys: true
|
||||
|
||||
attr_protected :supplier_id
|
||||
|
||||
validates :table_id, presence: true
|
||||
validates :supplier_id, presence: true
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ class Product
|
||||
belongs_to :supplier # direct! category is an aid
|
||||
has_many :product_orders
|
||||
|
||||
attr_protected :supplier_id
|
||||
|
||||
validates :name, presence: true
|
||||
validates :supplier_id, presence: true
|
||||
validates :price, presence: true, numericality: true
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ class ProductCategory
|
||||
|
||||
attr_protected :supplier_id
|
||||
|
||||
validates :name, presence: true
|
||||
validates :position, numericality: true
|
||||
validates :supplier_id, presence: true
|
||||
|
||||
|
||||
@@ -8,5 +8,6 @@ class ProductOrder
|
||||
belongs_to :order
|
||||
|
||||
view :by_product_id, key: :product_id
|
||||
view :by_order_id, key: :order_id
|
||||
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@ class Section
|
||||
include SimplyStored::Couch
|
||||
|
||||
property :title
|
||||
|
||||
property :path, type: Array, default: []
|
||||
|
||||
belongs_to :supplier
|
||||
@@ -12,6 +11,7 @@ class Section
|
||||
|
||||
attr_protected :supplier_id
|
||||
|
||||
validates :title, presence: true
|
||||
validates :supplier_id, presence: true
|
||||
|
||||
# Probably faster to directly retreive the document and return nil
|
||||
|
||||
Reference in New Issue
Block a user