mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-08 21:07:08 +10:00
remove unscoped
This commit is contained in:
@@ -68,7 +68,7 @@ class Api::V1::PostsController < Api::V1::ApplicationController
|
||||
|
||||
def get_post
|
||||
begin
|
||||
@post = Post.unscoped.find_or_create_by!(url: params[:url], type: @type)
|
||||
@post = Post.find_or_create_by!(url: params[:url], type: @type)
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
return render json: {msg: '缺少参数,校验失败'}, status: 400
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class ProcessPostWorker
|
||||
sidekiq_options queue: :post, retry: 3
|
||||
|
||||
def perform url
|
||||
post = Post.unscoped.find_by url: url
|
||||
post = Post.find_by url: url
|
||||
begin
|
||||
page = MetaInspector.new post.url
|
||||
post.title = page.title.try(:strip)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace :init do
|
||||
@user = User.first
|
||||
|
||||
def create_post(description, type, url)
|
||||
post = Post.unscoped.find_or_create_by!(url: url, type: type)
|
||||
post = Post.find_or_create_by!(url: url, type: type)
|
||||
@user.share_instances.create! sharable: post, description: description
|
||||
ProcessPostWorker.perform_async url
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user