Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
0883e469
Commit
0883e469
authored
Aug 29, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add manager to Product
parent
ea8c9629
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
1_create_shotengai_products_and_orders.rb
db/migrate/1_create_shotengai_products_and_orders.rb
+4
-0
product.rb
lib/shotengai/product.rb
+7
-2
shotengai_products.rb
spec/factories/shotengai_products.rb
+7
-0
No files found.
db/migrate/1_create_shotengai_products_and_orders.rb
View file @
0883e469
...
...
@@ -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
|
...
...
lib/shotengai/product.rb
View file @
0883e469
...
...
@@ -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
...
...
spec/factories/shotengai_products.rb
View file @
0883e469
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment