Commit 0883e469 by ivan Lan

Add manager to Product

parent ea8c9629
......@@ -13,10 +13,14 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
# Single Table Inheritance
t.string :type
t.json :meta
t.integer :manager_id
t.string :manager_type
t.timestamps
end
add_index :shotengai_products, [:manager_id, :manager_type]
add_index :shotengai_products, :type
create_table :shotengai_series do |t|
......
......@@ -15,17 +15,22 @@ module Shotengai
# detail :json
# type :string(255)
# meta :json
# manager_id :integer
# manager_type :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_shotengai_products_on_type (type)
# index_shotengai_products_on_manager_id_and_manager_type (manager_id,manager_type)
# index_shotengai_products_on_type (type)
#
class Shotengai::Product < ActiveRecord::Base
require 'acts-as-taggable-on'
self.table_name = 'shotengai_products'
belongs_to :manager, polymorphic: true, optional: true
validate :check_spec, if: :spec
include AASM_DLC
......
......@@ -14,9 +14,16 @@
# detail :json
# type :string(255)
# meta :json
# manager_id :integer
# manager_type :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_shotengai_products_on_manager_id_and_manager_type (manager_id,manager_type)
# index_shotengai_products_on_type (type)
#
FactoryGirl.define do
factory :test_good, class: 'TestGood' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment