[logaling-commit] logaling/logaling-server [master] Use current_user instead of @user

Back to archive index

SUZUKI Miho null+****@clear*****
Mon Sep 10 15:10:31 JST 2012


SUZUKI Miho	2012-09-10 15:10:31 +0900 (Mon, 10 Sep 2012)

  New Revision: 32fdfeb67e3cce8e24592e371a3d500524cab267
  https://github.com/logaling/logaling-server/commit/32fdfeb67e3cce8e24592e371a3d500524cab267

  Merged c5d082c: Merge pull request #13 from logaling/enable-creating-user-glossary

  Log:
    Use current_user instead of @user

  Modified files:
    app/controllers/user_glossaries_controller.rb

  Modified: app/controllers/user_glossaries_controller.rb (+2 -7)
===================================================================
--- app/controllers/user_glossaries_controller.rb    2012-09-10 15:05:32 +0900 (e21c036)
+++ app/controllers/user_glossaries_controller.rb    2012-09-10 15:10:31 +0900 (865a898)
@@ -1,7 +1,6 @@
 #coding: utf-8
 class UserGlossariesController < ApplicationController
   before_filter :authenticate!, :except => :show
-  before_filter :set_user
   before_filter :valid_user?, :only => [:new, :create]
   before_filter :set_user_glossary, :only => :create
 
@@ -38,16 +37,12 @@ class UserGlossariesController < ApplicationController
   end
 
   private
-  def set_user
-    @user = current_user
-  end
-
   def set_user_glossary
-    @user_glossary =****@user*****_glossaries.build(params[:user_glossary])
+    @user_glossary = current_user.user_glossaries.build(params[:user_glossary])
   end
 
   def valid_user?
-    if****@user***** != params[:user_id].to_i
+    if current_user.id != params[:user_id].to_i
       flash[:notice] = "不正なアクセスです"
       redirect_to dashboard_path
     end
-------------- next part --------------
An HTML attachment was scrubbed...
Télécharger 



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