2016-11-15 15:56:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-17 15:47:26 +00:00
|
|
|
class MediaController < ApplicationController
|
|
|
|
before_action :set_media_attachment
|
|
|
|
|
|
|
|
def show
|
2016-12-20 23:13:13 +00:00
|
|
|
redirect_to @media_attachment.file.url(:original)
|
2016-09-17 15:47:26 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_media_attachment
|
2017-01-05 23:21:12 +00:00
|
|
|
@media_attachment = MediaAttachment.where.not(status_id: nil).find_by!(shortcode: params[:id])
|
|
|
|
raise ActiveRecord::RecordNotFound unless @media_attachment.status.permitted?(current_account)
|
2016-09-17 15:47:26 +00:00
|
|
|
end
|
|
|
|
end
|