remove unscoped

This commit is contained in:
2015-12-02 23:51:58 +08:00
parent d9ebae1324
commit e6375319cb
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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