[logaling-commit] logaling/logaling-server [master] Fix problem when editing resrouces under user glossary

アーカイブの一覧に戻る

SHIMADA Koji null+****@clear*****
Mon Oct 8 13:27:20 JST 2012


SHIMADA Koji	2012-10-08 13:27:20 +0900 (Mon, 08 Oct 2012)

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

  Log:
    Fix problem when editing resrouces under user glossary

  Modified files:
    app/controllers/terms_controller.rb
    app/controllers/user_glossaries_controller.rb

  Modified: app/controllers/terms_controller.rb (+2 -1)
===================================================================
--- app/controllers/terms_controller.rb    2012-10-08 13:02:40 +0900 (29f6b53)
+++ app/controllers/terms_controller.rb    2012-10-08 13:27:20 +0900 (ab5d993)
@@ -1,5 +1,6 @@
 #coding: utf-8
 class TermsController < ApplicationController
+  before_filter :authenticate!
   before_filter :set_user_glossary
 
   def new
@@ -40,7 +41,7 @@ class TermsController < ApplicationController
 
   private
   def set_user_glossary
-    @user_glossary = UserGlossary.find(params[:glossary_id])
+    @user_glossary = UserGlossary.of(params[:glossary_id], current_user)
   rescue ActiveRecord::RecordNotFound
     render :file => 'public/404.html', :status => 404, :layout => false
   end

  Modified: app/controllers/user_glossaries_controller.rb (+2 -1)
===================================================================
--- app/controllers/user_glossaries_controller.rb    2012-10-08 13:02:40 +0900 (5cf9572)
+++ app/controllers/user_glossaries_controller.rb    2012-10-08 13:27:20 +0900 (8ab1fd7)
@@ -33,7 +33,8 @@ class UserGlossariesController < ApplicationController
 
   # DELETE /user_glossaries/1
   def destroy
-    @user_glossary = UserGlossary.find(params[:id])
+    user = User.find_by_name(params[:user_id])
+    @user_glossary = UserGlossary.of(params[:id], user)
     @user_glossary.destroy
     redirect_to dashboard_path, notice: 'User glossary was successfully destroyed.'
   rescue Logaling::CommandFailed, Logaling::GlossaryNotFound => e
-------------- next part --------------
An HTML attachment was scrubbed...
ダウンロード 



More information about the logaling-commit mailing list
アーカイブの一覧に戻る