Add /pixiv_ugoira_frame_data.json endpoint.

This commit is contained in:
evazion
2020-02-24 22:42:25 -06:00
parent 7c71311eef
commit 406bc5d87f
3 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
class PixivUgoiraFrameDataController < ApplicationController
respond_to :json, :xml
def index
@pixiv_ugoira_frame_data = PixivUgoiraFrameData.paginated_search(params)
respond_with(@pixiv_ugoira_frame_data)
end
end

View File

@@ -1,7 +1,19 @@
class PixivUgoiraFrameData < ApplicationRecord
belongs_to :post
serialize :data
before_validation :normalize_data, on: :create
def self.available_includes
[:post]
end
def self.search(params)
q = super
q = q.search_attributes(params, :post, :data, :content_type)
q.apply_default_order(params)
end
def normalize_data
return if data.nil?

View File

@@ -161,6 +161,7 @@ Rails.application.routes.draw do
end
resources :note_versions, :only => [:index, :show]
resource :note_previews, :only => [:show]
resources :pixiv_ugoira_frame_data, only: [:index]
resources :pools do
member do
put :revert