Class: ProductTours::MediaController

Inherits:
ApplicationController show all
Defined in:
app/controllers/product_tours/media_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



5
6
7
8
9
10
11
12
# File 'app/controllers/product_tours/media_controller.rb', line 5

def show
  post = Post.find(params[:id])
  allowed = ProductTours.admin?(request) || (ProductTours.enabled?(request) && post.published?)
  return head :forbidden unless allowed
  return head :not_found unless post.uploaded_video?

  redirect_to main_app.rails_blob_path(post.video, disposition: 'inline')
end