From f2eab9ee2d0f7f2c65aba0f2c5765040df2faa5e Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 30 Jun 2016 12:10:58 +0800 Subject: [PATCH] random other warnings fixed --- app/controllers/api/tokens_controller.rb | 2 +- app/controllers/topics_controller.rb | 10 +++++----- app/models/user.rb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/tokens_controller.rb b/app/controllers/api/tokens_controller.rb index 739fef9b..cea6ac5f 100644 --- a/app/controllers/api/tokens_controller.rb +++ b/app/controllers/api/tokens_controller.rb @@ -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 diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index c7b90da1..253f1ec1 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index 1961b72a..236bf4e1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 = {})