How do I return an ActivateStorage blob URL in JSON
In our system we are sending webhook to an endpoint with serialized JSON for the object JobApplication.
The JobApplication has a resume attached using ActiveStorage. ( has_one_attached :resume)
How can I return a public URL to the resume in my JSON
class JobApplicationSerializer
def self.exploded_json(object)
json =object.to_json(:except => [:user_id,:created_at, :updated_at],
:include => [
:state => {:only => [:id, :name,:code]},
:country => {:only => [:id, :name,:code]}
]
)
return json
end
end
include Rails.application.routes.url_helpers
def self.exploded_json(object)
json =object.to_json(:except => [:user_id,:created_at, :updated_at],
:include => [
:state => {:only => [:id, :name,:code]},
:country => {:only => [:id, :name,:code]}
]
)
if object.resume.attached?
json[:resume] = {
url: rails_blob_url(object.resume)
}
end
return json
end
I will also explain about Greatpeople me Kroger Schedule, Kroger great people.com schedule, feed kroger schedule today, krogerfeedback com schedule, Kroger employee schedule, Feed Kroger schedule.click here