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
25adb8bd
Commit
25adb8bd
authored
Oct 02, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method :are_they_your_columns? to Shotengai::Model
parent
042f9186
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
product_snapshots_controller.rb
...engai/controller/customer/product_snapshots_controller.rb
+0
-1
model.rb
lib/shotengai/model.rb
+11
-0
No files found.
lib/shotengai/controller/customer/product_snapshots_controller.rb
View file @
25adb8bd
...
...
@@ -31,7 +31,6 @@ module Shotengai
private
def
resource_params
remark_input
=
params
.
require
(
resource_key
).
fetch
(
:remark_input
,
nil
)
&
.
map
(
&
:permit!
)
params
.
require
(
resource_key
).
permit
(
:count
,
:shotengai_series_id
).
merge
({
remark_input:
remark_input
})
...
...
lib/shotengai/model.rb
View file @
25adb8bd
...
...
@@ -2,5 +2,15 @@ module Shotengai
class
Model
<
ApplicationRecord
self
.
abstract_class
=
true
include
Shotengai
::
JsonColumn
class
<<
self
def
are_they_your_columns?
columns
,
type
=
nil
valid
=
self
.
columns
.
select
{
|
column
|
type
.
nil?
||
column
.
type
.
eql?
(
type
.
to_sym
)
}.
map
(
&
:name
)
need
=
Array
(
columns
)
invalid
=
need
-
valid
raise
Shotengai
::
WebError
.
new
(
"Invalid columns:
#{
invalid
}
"
,
-
1
,
400
)
if
invalid
.
any?
need
end
end
end
end
\ No newline at end of file
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