lib/sn_foil/controller/api.rb in snfoil-rails-0.7.0 vs lib/sn_foil/controller/api.rb in snfoil-rails-0.7.1
- old
+ new
@@ -42,11 +42,11 @@
if model.errors.empty?
params
render json: serializer(**options).new(model,
**options,
params: (options[:controller_params] || options[:params] || {})
- .merge(current_entity: current_entity)).serializable_hash
+ .merge(current_entity: context_entity)).serializable_hash
else
render json: model.errors, status: :unprocessable_entity
end
end
@@ -60,19 +60,19 @@
def render_index(results, **options)
render json: serializer(**options).new(paginate(results, **options),
**options,
params: (options[:controller_params] || options[:params] || {})
- .merge(current_entity: current_entity),
+ .merge(current_entity: context_entity),
meta: meta(results, **options))
.serializable_hash
end
def render_show(model, **options)
render json: serializer(**options).new(model,
**options,
params: (options[:controller_params] || options[:params] || {})
- .merge(current_entity: current_entity)).serializable_hash
+ .merge(current_entity: context_entity)).serializable_hash
end
private
def inject_deserialized_params(**options)