random other warnings fixed

This commit is contained in:
Devin Howard 2016-06-30 12:10:58 +08:00
parent f01aed9d37
commit f2eab9ee2d
3 changed files with 7 additions and 7 deletions

View file

@ -1,6 +1,6 @@
class Api::TokensController < API::RestfulController
def my_tokens
raise Pundit::NotAuthorizedError.new unless current_user
raise Pundit::NotAuthorizedError unless current_user
instantiate_collection page_collection: false, timeframe_collection: false
respond_with_collection
end

View file

@ -9,11 +9,11 @@ class TopicsController < ApplicationController
# GET /topics/autocomplete_topic
def autocomplete_topic
term = params[:term]
if term && !term.empty?
@topics = policy_scope(Topic.where('LOWER("name") like ?', term.downcase + '%')).order('"name"')
else
@topics = []
end
@topics = if term && !term.empty?
policy_scope(Topic.where('LOWER("name") like ?', term.downcase + '%')).order('"name"')
else
[]
end
render json: autocomplete_array_json(@topics)
end

View file

@ -40,7 +40,7 @@ class User < ActiveRecord::Base
default_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png'
# Validate the attached image is image/jpg, image/png, etc
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
validates_attachment_content_type :image, content_type: %r(\Aimage/.*\Z)
# override default as_json
def as_json(_options = {})