diff --git a/app/controllers/glossary_categories_controller.rb b/app/controllers/glossary_categories_controller.rb index 02eb7f5..be5289c 100644 --- a/app/controllers/glossary_categories_controller.rb +++ b/app/controllers/glossary_categories_controller.rb @@ -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 diff --git a/app/controllers/glossary_terms_controller.rb b/app/controllers/glossary_terms_controller.rb index 4822091..5f47470 100644 --- a/app/controllers/glossary_terms_controller.rb +++ b/app/controllers/glossary_terms_controller.rb @@ -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