[logaling-commit] logaling/logaling-server [github-project-related-to-user] Extract #valid_user?

Back to archive index

SUZUKI Miho null+****@clear*****
Mon Sep 24 10:35:36 JST 2012


SUZUKI Miho	2012-09-24 10:35:36 +0900 (Mon, 24 Sep 2012)

  New Revision: 400f38987b5537b70f38c41634c43e3d6b5d9217
  https://github.com/logaling/logaling-server/commit/400f38987b5537b70f38c41634c43e3d6b5d9217

  Merged 971b851: Merge pull request #14 from logaling/prioritize-the-search

  Log:
    Extract #valid_user?

  Modified files:
    app/controllers/application_controller.rb
    app/controllers/user_configs_controller.rb
    app/controllers/user_glossaries_controller.rb

  Modified: app/controllers/application_controller.rb (+7 -0)
===================================================================
--- app/controllers/application_controller.rb    2012-09-21 23:51:11 +0900 (93061a3)
+++ app/controllers/application_controller.rb    2012-09-24 10:35:36 +0900 (35d9a19)
@@ -1,3 +1,4 @@
+#coding: utf-8
 class ApplicationController < ActionController::Base
   protect_from_forgery
   helper_method :current_user, :signed_in?
@@ -18,4 +19,10 @@ class ApplicationController < ActionController::Base
       true
     end
   end
+
+  def valid_user?
+    if current_user.id != params[:user_id].to_i
+      redirect_to dashboard_path, notice: "不正なアクセスです"
+    end
+  end
 end

  Modified: app/controllers/user_configs_controller.rb (+0 -7)
===================================================================
--- app/controllers/user_configs_controller.rb    2012-09-21 23:51:11 +0900 (4222314)
+++ app/controllers/user_configs_controller.rb    2012-09-24 10:35:36 +0900 (f0cb850)
@@ -11,11 +11,4 @@ class UserConfigsController < ApplicationController
   rescue => e
     redirect_to dashboard_path, notice: 'User config setting was failed.'
   end
-
-  private
-  def valid_user?
-    if current_user.id != params[:user_id].to_i
-      redirect_to dashboard_path, notice: "不正なアクセスです"
-    end
-  end
 end

  Modified: app/controllers/user_glossaries_controller.rb (+0 -7)
===================================================================
--- app/controllers/user_glossaries_controller.rb    2012-09-21 23:51:11 +0900 (63d8388)
+++ app/controllers/user_glossaries_controller.rb    2012-09-24 10:35:36 +0900 (7f25767)
@@ -38,11 +38,4 @@ class UserGlossariesController < ApplicationController
       format.json { render json: @user_glossary.errors, status: :unprocessable_entity }
     end
   end
-
-  private
-  def valid_user?
-    if current_user.id != params[:user_id].to_i
-      redirect_to dashboard_path, notice: "不正なアクセスです"
-    end
-  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



More information about the logaling-commit mailing list
Back to archive index