File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -424,7 +424,9 @@ def inherited(subclass)
424424 type = subclass . name . demodulize . sub ( /Resource$/ , '' ) . underscore
425425 subclass . _type = type . pluralize . to_sym
426426
427- subclass . attribute :id , format : :id
427+ unless subclass . _attributes [ :id ]
428+ subclass . attribute :id , format : :id , readonly : true
429+ end
428430
429431 check_reserved_resource_name ( subclass . _type , subclass . name )
430432 end
Original file line number Diff line number Diff line change @@ -1111,7 +1111,7 @@ def self.updatable_fields(context)
11111111 end
11121112
11131113 def self . creatable_fields ( context )
1114- super ( context ) - [ :subject , :id ]
1114+ super ( context ) - [ :subject ]
11151115 end
11161116
11171117 def self . sortable_fields ( context )
@@ -1132,6 +1132,7 @@ class HairCutResource < JSONAPI::Resource
11321132
11331133class IsoCurrencyResource < JSONAPI ::Resource
11341134 attributes :name , :country_name , :minor_unit
1135+ attribute :id , format : :id , readonly : false
11351136
11361137 filter :country_name
11371138
You can’t perform that action at this time.
0 commit comments