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 class Api::TokensController < API::RestfulController
def my_tokens def my_tokens
raise Pundit::NotAuthorizedError.new unless current_user raise Pundit::NotAuthorizedError unless current_user
instantiate_collection page_collection: false, timeframe_collection: false instantiate_collection page_collection: false, timeframe_collection: false
respond_with_collection respond_with_collection
end end

View file

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

View file

@ -40,7 +40,7 @@ class User < ActiveRecord::Base
default_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png' default_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png'
# Validate the attached image is image/jpg, image/png, etc # 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 # override default as_json
def as_json(_options = {}) def as_json(_options = {})