]> source.dussan.org Git - redmine.git/commitdiff
Refactor: Pull up several #find_project methods to ApplicationController
authorEric Davis <edavis@littlestreamsoftware.com>
Fri, 5 Feb 2010 16:57:02 +0000 (16:57 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Fri, 5 Feb 2010 16:57:02 +0000 (16:57 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3370 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/application_controller.rb
app/controllers/members_controller.rb
app/controllers/projects_controller.rb
app/controllers/reports_controller.rb
app/controllers/repositories_controller.rb
app/controllers/wikis_controller.rb

index 16652c8f7deaf5c51446d89548688c3a4a6e32a2..74f4aef273cc2c78e6d4cb6edd5ca4252df71b65 100644 (file)
@@ -159,6 +159,13 @@ class ApplicationController < ActionController::Base
   def authorize_global(ctrl = params[:controller], action = params[:action], global = true)
     authorize(ctrl, action, global)
   end
+
+  # Find project of id params[:id]
+  def find_project
+    @project = Project.find(params[:id])
+  rescue ActiveRecord::RecordNotFound
+    render_404
+  end
   
   # make sure that the user is a member of the project (or admin) if project is private
   # used as a before_filter for actions that do not require any particular permission on the project
index 3bfa606e1b1b930365bd07b472a29a4baed23953..e3f4a16e6e75a2b327eb2ee09bcb168263ece354 100644 (file)
@@ -74,12 +74,6 @@ class MembersController < ApplicationController
   end
 
 private
-  def find_project
-    @project = Project.find(params[:id])
-  rescue ActiveRecord::RecordNotFound
-    render_404
-  end
-  
   def find_member
     @member = Member.find(params[:id]) 
     @project = @member.project
index bd2e2a8dcdfa43e98b5c52d8501ccebc707736e0..945e4b7211b128c5c8ee70dccf7dbd8a582af25c 100644 (file)
@@ -413,15 +413,6 @@ class ProjectsController < ApplicationController
   end
   
 private
-  # Find project of id params[:id]
-  # if not found, redirect to project list
-  # Used as a before_filter
-  def find_project
-    @project = Project.find(params[:id])
-  rescue ActiveRecord::RecordNotFound
-    render_404
-  end
-  
   def find_optional_project
     return true unless params[:id]
     @project = Project.find(params[:id])
index e8acdc661fb3ca979234ea4504474b181343084d..e057c6c0a77dd03840f1d853c71fb6eb483489f7 100644 (file)
@@ -86,13 +86,6 @@ class ReportsController < ApplicationController
   end  
   
 private
-  # Find project of id params[:id]
-  def find_project
-    @project = Project.find(params[:id])               
-  rescue ActiveRecord::RecordNotFound
-    render_404
-  end
-
   def issues_by_tracker
     @issues_by_tracker ||= Issue.by_tracker(@project)
   end
index 745159ec71a466c987fc74981ce2a6dbc571e787..714dfedde840eaa7133a7f9e4ef4f65845bcb7b0 100644 (file)
@@ -190,12 +190,6 @@ class RepositoriesController < ApplicationController
   end
   
 private
-  def find_project
-    @project = Project.find(params[:id])
-  rescue ActiveRecord::RecordNotFound
-    render_404
-  end
-  
   def find_repository
     @project = Project.find(params[:id])
     @repository = @project.repository
index 215d39f4b0c1a552e9b51d972e0436d90263e695..2238651cca41239dbaaf9276045abd88b33ee4a9 100644 (file)
@@ -34,11 +34,4 @@ class WikisController < ApplicationController
       redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki'
     end    
   end
-  
-private
-  def find_project
-    @project = Project.find(params[:id])
-  rescue ActiveRecord::RecordNotFound
-    render_404
-  end
 end