From 1db7bde85c6755c26169d7c7bdd6828294b838cb Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sun, 14 Jul 2019 09:35:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/libraries_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index 27e814d7..ecbe41e4 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -1,7 +1,7 @@ class LibrariesController < ApplicationController layout 'base_library' - before_filter :require_login, :except => [:index] + before_filter :require_login, :except => [:index, :show] after_filter :increment_visit_count, only: [:show, :create, :edit, :update] def index @@ -121,7 +121,7 @@ class LibrariesController < ApplicationController end def admin_or_self? - current_library.user_id == current_user.id || admin_or_business? + current_library.try(:user_id) == current_user.try(:id) || admin_or_business? end def increment_visit_count