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
1b07f88f
Commit
1b07f88f
authored
Aug 26, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use model_name instead of model itself as an attr of method join_catalog_system
parent
dffe197f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
product.rb
lib/shotengai/product.rb
+2
-1
models_spec.rb
spec/shotengai/models_spec.rb
+2
-2
No files found.
lib/shotengai/product.rb
View file @
1b07f88f
...
...
@@ -71,7 +71,8 @@ module Shotengai
# Will get methods:
# "#{tag_name}_list" tag_name is singular
# tagger_with('xx', on: "#{tag_name}.to_sym): tag_name is plural
def
join_catalog_system
catalog_class
,
options
=
{}
def
join_catalog_system
catalog_class_name
,
options
=
{}
catalog_class
=
catalog_class_name
.
constantize
tag_name
=
options
[
:as
]
||
catalog_class
.
model_name
.
collection
acts_as_taggable_on
tag_name
.
to_sym
# 只有完整替换(只属于一个分类)的时候才进行验证,add remove 暂时未添加
...
...
spec/shotengai/models_spec.rb
View file @
1b07f88f
...
...
@@ -214,8 +214,8 @@ RSpec.describe 'Shotengai Models' do
describe
'Catalog System With Product'
do
before
do
class
TestGood
<
Shotengai
::
Product
join_catalog_system
ClothingCatalog
,
as: :sort
join_catalog_system
OtherCatalog
join_catalog_system
'ClothingCatalog'
,
as: :sort
join_catalog_system
'OtherCatalog'
end
end
...
...
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