Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tenanting models

  • Loading branch information...
commit bdde6da0f18fd9065abf1c7b8ea54a474b981938 1 parent 58c4c6a
@cactusapp cactusapp authored
Showing with 64 additions and 13 deletions.
  1. +2 −0  app/models/assignment.rb
  2. +2 −0  app/models/assignment_type.rb
  3. +2 −0  app/models/company.rb
  4. +1 −0  app/models/country.rb
  5. +2 −0  app/models/customer.rb
  6. +2 −0  app/models/customer_type.rb
  7. +3 −1 app/models/dimension_uom.rb
  8. +1 −0  app/models/order.rb
  9. +2 −0  app/models/order_line.rb
  10. +2 −0  app/models/order_type.rb
  11. +2 −0  app/models/product.rb
  12. +2 −0  app/models/product_category.rb
  13. +2 −0  app/models/product_status.rb
  14. +2 −0  app/models/product_subcategory.rb
  15. +2 −0  app/models/purchase_order.rb
  16. +2 −0  app/models/purchase_order_line.rb
  17. +2 −0  app/models/purchase_order_type.rb
  18. +2 −0  app/models/quantity_uom.rb
  19. +2 −0  app/models/receipt.rb
  20. +2 −0  app/models/receipt_line.rb
  21. +2 −0  app/models/receipt_type.rb
  22. +2 −0  app/models/supplier.rb
  23. +2 −0  app/models/uom.rb
  24. +3 −1 app/models/volume_uom.rb
  25. +2 −0  app/models/warehouse.rb
  26. +3 −1 app/models/weight_uom.rb
  27. +1 −1  config/initializers/roomer.rb
  28. +1 −0  config/routes.rb
  29. 0  db/migrate/{tenanted → global}/20100402141715_create_countries.rb
  30. 0  db/migrate/{tenanted → global}/20100912041458_country_remove_code.rb
  31. +9 −0 db/schemas/shared_schema.rb
  32. +0 −9 db/schemas/tenanted_schema.rb
View
2  app/models/assignment.rb
@@ -1,5 +1,7 @@
class Assignment < ActiveRecord::Base
+ roomer :tenanted
+
has_many :assignment_details, dependent: :destroy
belongs_to :warehouse
View
2  app/models/assignment_type.rb
@@ -1,5 +1,7 @@
class AssignmentType < ActiveRecord::Base
+ roomer :tenanted
+
belongs_to :company
end
View
2  app/models/company.rb
@@ -1,5 +1,7 @@
class Company < ActiveRecord::Base
+ roomer :tenanted
+
belongs_to :country
has_many :warehouses
has_many :products
View
1  app/models/country.rb
@@ -4,4 +4,5 @@ class Country < ActiveRecord::Base
validates :name, :iso_code, presence: true
+ roomer :shared
end
View
2  app/models/customer.rb
@@ -1,5 +1,7 @@
class Customer < ActiveRecord::Base
+ roomer :tenanted
+
belongs_to :customer_type
belongs_to :company
View
2  app/models/customer_type.rb
@@ -1,5 +1,7 @@
class CustomerType < ActiveRecord::Base
+ roomer :tenanted
+
belongs_to :company
has_many :customers
has_many :allocation_strategy_rules
View
4 app/models/dimension_uom.rb
@@ -1,3 +1,5 @@
class DimensionUom < Uom
-end
+ roomer :tenanted
+
+end
View
1  app/models/order.rb
@@ -1,5 +1,6 @@
class Order < ActiveRecord::Base
+ roomer :tenanted
include AASM
View
2  app/models/order_line.rb
@@ -1,5 +1,7 @@
class OrderLine < ActiveRecord::Base
+ roomer :tenanted
+
before_create :find_allocation_strategy
validates :line_sequence_number, :product_id, :quantity_ordered, :order_id, presence: true
View
2  app/models/order_type.rb
@@ -1,5 +1,7 @@
class OrderType < ActiveRecord::Base
+ roomer :tenanted
+
validates :order_type, :company_id, presence: true
validates :order_type, uniqueness: true
View
2  app/models/product.rb
@@ -1,6 +1,8 @@
class Product < ActiveRecord::Base
+ roomer :tenanted
+
belongs_to :company
belongs_to :supplier
belongs_to :product_category
View
2  app/models/product_category.rb
@@ -1,5 +1,7 @@
class ProductCategory < ActiveRecord::Base
+ roomer :tenanted
+
validates :name, uniqueness: true
validates :name, :description, :company_id, presence: true
View
2  app/models/product_status.rb
@@ -1,5 +1,7 @@
class ProductStatus < ActiveRecord::Base
+ roomer :tenanted
+
validates :code, :description, :company_id, presence: true
validates :code, uniqueness: true
View
2  app/models/product_subcategory.rb
@@ -1,5 +1,7 @@
class ProductSubcategory < ActiveRecord::Base
+ roomer :tenanted
+
validates :name, :description, :product_category, :company_id, presence: true
validates :name, uniqueness: true
View
2  app/models/purchase_order.rb
@@ -1,5 +1,7 @@
class PurchaseOrder < ActiveRecord::Base
+ roomer :tenanted
+
include AASM
aasm_column :state
View
2  app/models/purchase_order_line.rb
@@ -1,5 +1,7 @@
class PurchaseOrderLine < ActiveRecord::Base
+ roomer :tenanted
+
include AASM
aasm_column :state
View
2  app/models/purchase_order_type.rb
@@ -1,5 +1,7 @@
class PurchaseOrderType < ActiveRecord::Base
+ roomer :tenanted
+
validates :purchase_order_type, :company_id, presence: true
validates :purchase_order_type, uniqueness: true
View
2  app/models/quantity_uom.rb
@@ -1,3 +1,5 @@
class QuantityUom < Uom
+ roomer :tenanted
+
end
View
2  app/models/receipt.rb
@@ -1,5 +1,7 @@
class Receipt < ActiveRecord::Base
+ roomer :tenanted
+
include AASM
aasm_column :state
View
2  app/models/receipt_line.rb
@@ -1,5 +1,7 @@
class ReceiptLine < ActiveRecord::Base
+ roomer :tenanted
+
include AASM
View
2  app/models/receipt_type.rb
@@ -1,5 +1,7 @@
class ReceiptType < ActiveRecord::Base
+ roomer :tenanted
+
belongs_to :company
has_many :receipts
has_many :storage_strategy_rules
View
2  app/models/supplier.rb
@@ -1,5 +1,7 @@
class Supplier < ActiveRecord::Base
+ roomer :tenanted
+
validates :name, :address_1, :city, :country_id, :company_id, presence: true
validates :name, uniqueness: true
belongs_to :country
View
2  app/models/uom.rb
@@ -1,5 +1,7 @@
class Uom < ActiveRecord::Base
+ roomer :tenanted
+
validates_uniqueness_of :code, scope: :company_id
validates_uniqueness_of :name, scope: :company_id
validates :type, :code, :name, :company_id, presence: true
View
4 app/models/volume_uom.rb
@@ -1,3 +1,5 @@
class VolumeUom < Uom
+
+ roomer :tenanted
-end
+end
View
2  app/models/warehouse.rb
@@ -1,5 +1,7 @@
class Warehouse < ActiveRecord::Base
+ roomer :tenanted
+
belongs_to :company
belongs_to :country
has_many :locations
View
4 app/models/weight_uom.rb
@@ -1,3 +1,5 @@
class WeightUom < Uom
-end
+ roomer :tenanted
+
+end
View
2  config/initializers/roomer.rb
@@ -60,7 +60,7 @@
# Set to true for automatic inclusion
# of Roomer::Extensions::Controller in
# Application::Controller
- # config.install_controller_extensions = false
+ config.install_controller_extensions = true
# Safe to run on Heroku
# Roomer.heroku_safe = true
View
1  config/routes.rb
@@ -153,6 +153,7 @@
controller :setup do
get 'index' => :index
+ post 'create_company' => :create_company
end
# You can have the root of your site routed with "root"
View
0  ...grate/tenanted/20100402141715_create_countries.rb → db/migrate/global/20100402141715_create_countries.rb
File renamed without changes
View
0  ...te/tenanted/20100912041458_country_remove_code.rb → ...rate/global/20100912041458_country_remove_code.rb
File renamed without changes
View
9 db/schemas/shared_schema.rb
@@ -2,6 +2,15 @@
Roomer::Schema.define(:version => 20130920042236) do
+ create_table "countries", :force => true do |t|
+ t.string "name", :null => false
+ t.string "iso_code", :limit => 3
+ t.string "language", :limit => 25
+ t.integer "telephone_country_code"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "tenants", :force => true do |t|
t.string "url_identifier"
t.string "schema_name"
View
9 db/schemas/tenanted_schema.rb
@@ -137,15 +137,6 @@
t.string "state", :limit => 50, :null => false
end
- create_table "countries", :force => true do |t|
- t.string "name", :null => false
- t.string "iso_code", :limit => 3
- t.string "language", :limit => 25
- t.integer "telephone_country_code"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
create_table "customer_types", :force => true do |t|
t.integer "company_id", :null => false
t.string "code", :limit => 5, :null => false
Please sign in to comment.
Something went wrong with that request. Please try again.