[refactoring]changed calling method to find project to use redmine's standard method.

This commit is contained in:
Toru Takahashi 2018-05-23 04:15:31 +09:00 committed by TAKAHASHI,Toru
parent 7fa90d3427
commit 7ebd27c74d
2 changed files with 2 additions and 16 deletions

View File

@ -1,7 +1,7 @@
class GlossaryCategoriesController < ApplicationController
before_action :find_category_from_id, only: [:show, :edit, :update, :destroy]
before_action :find_project_from_id, :authorize
before_action :find_project_by_project_id, :authorize
def index
@categories = GlossaryCategory.where(project_id: @project.id)
@ -48,13 +48,6 @@ class GlossaryCategoriesController < ApplicationController
private
# Find the project whose id is the :project_id parameter
def find_project_from_id
@project = Project.find(params[:project_id])
rescue ActiveRecord::RecordNotFound
render_404
end
def glossary_category_params
params.require(:glossary_category).permit(
:name

View File

@ -1,7 +1,7 @@
class GlossaryTermsController < ApplicationController
before_action :find_term_from_id, only: [:show, :edit, :update, :destroy]
before_action :find_project_from_id, :authorize
before_action :find_project_by_project_id, :authorize
def index
@glossary_terms = GlossaryTerm.where(project_id: @project.id)
@ -44,13 +44,6 @@ class GlossaryTermsController < ApplicationController
render_404
end
# Find the project whose id is the :project_id parameter
def find_project_from_id
@project = Project.find(params[:project_id])
rescue ActiveRecord::RecordNotFound
render_404
end
private
def glossary_term_params