lib/drillbit/authorizers/parameters/resource.rb in drillbit-2.3.1 vs lib/drillbit/authorizers/parameters/resource.rb in drillbit-2.4.0
- old
+ new
@@ -19,13 +19,11 @@
:id,
{
attributes: [
{},
],
- relationships: [
- {},
- ],
+ relationships: {},
},
],
]
end
@@ -50,15 +48,16 @@
def add_authorized_relationship(name)
param = params.
fetch(:data, {}).
fetch(:relationships, {}).
- fetch(name, nil)
+ fetch(name, {}).
+ fetch(:data, nil)
- if param.class == Array
- authorized_params[1][:data][2][:relationships][0][name] = []
+ if param.nil?
+ authorized_params[1][:data][2][:relationships][name] = [:data]
else
- authorized_params[1][:data][2][:relationships] << name
+ authorized_params[1][:data][2][:relationships][name] = { data: %i{type id} }
end
end
def add_authorized_relationships(*names)
names.each do |name|