File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ def jsonapi_resource(*resources, &_block)
3232 options [ :except ] = [ :new , :edit ]
3333 end
3434
35+ if res . _immutable
36+ options [ :except ] << :create unless options [ :except ] . include? ( :create ) || options [ :except ] . include? ( 'create' )
37+ options [ :except ] << :update unless options [ :except ] . include? ( :update ) || options [ :except ] . include? ( 'update' )
38+ options [ :except ] << :destroy unless options [ :except ] . include? ( :destroy ) || options [ :except ] . include? ( 'destroy' )
39+ end
40+
3541 resource @resource_type , options do
3642 # :nocov:
3743 if @scope . respond_to? :[]=
@@ -96,9 +102,9 @@ def jsonapi_resources(*resources, &_block)
96102 end
97103
98104 if res . _immutable
99- options [ :except ] << :create
100- options [ :except ] << :update
101- options [ :except ] << :destroy
105+ options [ :except ] << :create unless options [ :except ] . include? ( :create ) || options [ :except ] . include? ( 'create' )
106+ options [ :except ] << :update unless options [ :except ] . include? ( :update ) || options [ :except ] . include? ( 'update' )
107+ options [ :except ] << :destroy unless options [ :except ] . include? ( :destroy ) || options [ :except ] . include? ( 'destroy' )
102108 end
103109
104110 resources @resource_type , options do
You can’t perform that action at this time.
0 commit comments