aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/controllers/concerns/active_storage/set_blob.rb
blob: b0f3d97a66edf38bd276d10eefdfc05296daca26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module ActiveStorage::SetBlob
  extend ActiveSupport::Concern

  included do
    before_action :set_blob
  end

  private
    def set_blob
      @blob = ActiveStorage::Blob.find_signed(params[:signed_blob_id] || params[:signed_id])
    rescue ActiveSupport::MessageVerifier::InvalidSignature
      head :not_found
    end
end