docbrown/app/controllers/api/v0/videos_controller.rb
Jess Lee 175569fb97 "/videos" (#2291)
* set up video route

* add video index

* update styling

* fix mobile full width styling

* bust cache when new video is created

* add unlimited scrolling
2019-04-05 14:02:03 -04:00

23 lines
667 B
Ruby

module Api
module V0
class VideosController < ApiController
caches_action :index,
cache_path: proc { |c| c.params.permit! },
expires_in: 10.minutes
respond_to :json
caches_action :show,
cache_path: proc { |c| c.params.permit! },
expires_in: 10.minutes
respond_to :json
before_action :cors_preflight_check
after_action :cors_set_access_control_headers
def index
@page = params[:page]
@video_articles = Article.where.not(video: nil, video_thumbnail_url: nil).where(published: true).order("published_at DESC").page(params[:page].to_i).per(24)
end
end
end
end