2016-11-16 00:56:29 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-18 00:47:26 +09:00
|
|
|
class MediaController < ApplicationController
|
2017-04-18 03:02:00 +09:00
|
|
|
before_action :verify_permitted_status
|
2016-09-18 00:47:26 +09:00
|
|
|
|
|
|
|
def show
|
2017-04-18 03:02:00 +09:00
|
|
|
redirect_to media_attachment.file.url(:original)
|
2016-09-18 00:47:26 +09:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2017-04-18 03:02:00 +09:00
|
|
|
def media_attachment
|
|
|
|
MediaAttachment.attached.find_by!(shortcode: params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def verify_permitted_status
|
|
|
|
raise ActiveRecord::RecordNotFound unless media_attachment.status.permitted?(current_account)
|
2016-09-18 00:47:26 +09:00
|
|
|
end
|
|
|
|
end
|