Fix all the errors to get our tests green on Rails 5.1.

This commit is contained in:
Guo Xiang Tan
2017-08-31 12:06:56 +08:00
parent 898ee93547
commit 77d4c4d8dc
989 changed files with 5114 additions and 3117 deletions

View File

@ -2,10 +2,10 @@ require_dependency 'category_serializer'
class CategoriesController < ApplicationController
before_filter :ensure_logged_in, except: [:index, :categories_and_latest, :show, :redirect, :find_by_slug]
before_filter :fetch_category, only: [:show, :update, :destroy]
before_filter :initialize_staff_action_logger, only: [:create, :update, :destroy]
skip_before_filter :check_xhr, only: [:index, :categories_and_latest, :redirect]
before_action :ensure_logged_in, except: [:index, :categories_and_latest, :show, :redirect, :find_by_slug]
before_action :fetch_category, only: [:show, :update, :destroy]
before_action :initialize_staff_action_logger, only: [:create, :update, :destroy]
skip_before_action :check_xhr, only: [:index, :categories_and_latest, :redirect]
def redirect
redirect_to path("/c/#{params[:path]}")
@ -107,8 +107,9 @@ class CategoriesController < ApplicationController
by_category.each do |cat, pos|
cat.position = pos
cat.save if cat.position_changed?
cat.save! if cat.will_save_change_to_position?
end
render json: success_json
end
@ -154,7 +155,7 @@ class CategoriesController < ApplicationController
old_permissions = cat.permissions_params
if result = cat.update_attributes(category_params)
if result = cat.update(category_params)
Scheduler::Defer.later "Log staff action change category settings" do
@staff_action_logger.log_category_settings_change(@category, category_params, old_permissions)
end