Skip to content
Snippets Groups Projects
Commit b5f8da38 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Fix render error in package_controller

parent f4b0ac6b
No related branches found
No related tags found
No related merge requests found
......@@ -21,12 +21,16 @@ class V1::PackagesController < ApplicationController
before_action :set_objects
def link
response = PackageService.link(@objects)
if response.nil?
if @objects.blank?
render status: :not_found
else
render json: { url: response }, status: :found
response = PackageService.link(@objects)
if response.nil?
render status: :not_found
else
render json: { url: response }, status: :found
end
end
end
......@@ -34,11 +38,10 @@ class V1::PackagesController < ApplicationController
def set_objects
allowed = PackageService.allowed_classes
@objects = objects_params[:object].map do |o|
next unless allowed.include? o['type']
obj = o['type'].constantize.where(id: o['id']).first
render status: :not_found if @obj.blank?
break if @obj.blank?
obj
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment