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
18bdb58e
Commit
18bdb58e
authored
Aug 26, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add series to product show & Add uniq validation for spec of series
parent
11ba283c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
_product.json.jbuilder
lib/generators/templates/views/share/_product.json.jbuilder
+2
-0
base.rb
lib/shotengai/controllers/base.rb
+6
-1
products_controller.rb
lib/shotengai/controllers/merchant/products_controller.rb
+0
-5
series.rb
lib/shotengai/series.rb
+1
-0
No files found.
lib/generators/templates/views/share/_product.json.jbuilder
View file @
18bdb58e
...
...
@@ -3,3 +3,4 @@ json.extract! product, :id, :title, :status, :need_express, :need_time_attr,
# TODO: NOTE: catalog_list is only vaild in the template example
json.catalog_list product.catalog_list
json.default_series product.default_series, partial: 'shotengai/share/series_simple', as: :series
json.series product.series, partial: 'shotengai/share/series_simple', as: :series
\ No newline at end of file
lib/shotengai/controllers/base.rb
View file @
18bdb58e
...
...
@@ -96,7 +96,12 @@ module Shotengai
end
def
resource_params
params
.
requrie
(
resource_key
)
params
.
requrie
(
resource_key
).
permit!
.
merge
other_resource_params
end
# rewrite this to add more custom column
def
other_resource_params
params
.
require
(
resource_key
).
permit!
end
end
end
...
...
lib/shotengai/controllers/merchant/products_controller.rb
View file @
18bdb58e
...
...
@@ -43,11 +43,6 @@ module Shotengai
other_resource_params
)
end
# rewrite this to add more custom column
def
other_resource_params
params
.
require
(
resource_key
).
permit
()
end
end
end
end
...
...
lib/shotengai/series.rb
View file @
18bdb58e
...
...
@@ -23,6 +23,7 @@ module Shotengai
class
Series
<
ActiveRecord
::
Base
self
.
table_name
=
'shotengai_series'
validate
:check_spec
,
if: :spec
validates_uniqueness_of
:spec
,
scope: :shotengai_products_id
delegate
:detail
,
:banners
,
:cover_image
,
to: :product
...
...
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