* API Articles v0-v1 restructure * Remove unused helper * Bulk move API controllers into concerns + add V1 controllers * Extract API routes + some fixes * Fix v1 api_controller authenticate! + add more article_controller specs * Completed spec/requests/api/v1/articles_spec.rb * specs up to listings * All v1 specs except for 9 skips * mime_types cleanup + authenticate! relocation Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
27 lines
549 B
Ruby
27 lines
549 B
Ruby
module Api
|
|
module ProfileImagesController
|
|
extend ActiveSupport::Concern
|
|
|
|
def show
|
|
not_found unless profile_image_owner
|
|
|
|
@profile_image_owner = profile_image_owner
|
|
end
|
|
|
|
private
|
|
|
|
def profile_image_owner
|
|
user || organization
|
|
end
|
|
|
|
def user
|
|
@user ||= User.registered.select(:id, :profile_image)
|
|
.find_by(username: params[:username])
|
|
end
|
|
|
|
def organization
|
|
@organization ||= Organization.select(:id, :profile_image)
|
|
.find_by(username: params[:username])
|
|
end
|
|
end
|
|
end
|