lib/jsonapi/routing_ext.rb in jsonapi-resources-0.8.1 vs lib/jsonapi/routing_ext.rb in jsonapi-resources-0.8.2
- old
+ new
@@ -30,10 +30,16 @@
options[:except] << :edit unless options[:except].include?(:edit) || options[:except].include?('edit')
else
options[:except] = [:new, :edit]
end
+ if res._immutable
+ options[:except] << :create unless options[:except].include?(:create) || options[:except].include?('create')
+ options[:except] << :update unless options[:except].include?(:update) || options[:except].include?('update')
+ options[:except] << :destroy unless options[:except].include?(:destroy) || options[:except].include?('destroy')
+ end
+
resource @resource_type, options do
# :nocov:
if @scope.respond_to? :[]=
# Rails 4
@scope[:jsonapi_resource] = @resource_type
@@ -94,12 +100,12 @@
else
options[:except] = [:new, :edit]
end
if res._immutable
- options[:except] << :create
- options[:except] << :update
- options[:except] << :destroy
+ options[:except] << :create unless options[:except].include?(:create) || options[:except].include?('create')
+ options[:except] << :update unless options[:except].include?(:update) || options[:except].include?('update')
+ options[:except] << :destroy unless options[:except].include?(:destroy) || options[:except].include?('destroy')
end
resources @resource_type, options do
# :nocov:
if @scope.respond_to? :[]=