From 245bb88112309c33df29f7057efde1f8fdce6737 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Thu, 8 Mar 2018 18:32:56 -0500 Subject: [PATCH] remove html format from controller and allow anyone access to index --- app/controllers/metacode_sets_controller.rb | 39 +-------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/app/controllers/metacode_sets_controller.rb b/app/controllers/metacode_sets_controller.rb index bfa77b1c..4ac60a60 100644 --- a/app/controllers/metacode_sets_controller.rb +++ b/app/controllers/metacode_sets_controller.rb @@ -2,7 +2,7 @@ class MetacodeSetsController < ApplicationController include MetacodesHelper - before_action :require_admin + before_action :require_admin, except: :index # GET /metacode_sets # GET /metacode_sets.json @@ -10,39 +10,10 @@ class MetacodeSetsController < ApplicationController @metacode_sets = MetacodeSet.order('name').all respond_to do |format| - format.html # index.html.erb format.json { render json: metacode_sets_json } end end - ### SHOW IS NOT CURRENTLY IN USE - # GET /metacode_sets/1 - # GET /metacode_sets/1.json - # def show - # @metacode_set = MetacodeSet.find(params[:id]) - # - # respond_to do |format| - # format.html # show.html.erb - # format.json { render json: @metacode_set } - # end - # end - - # GET /metacode_sets/new - # GET /metacode_sets/new.json - def new - @metacode_set = MetacodeSet.new - - respond_to do |format| - format.html # new.html.erb - format.json { render json: @metacode_set } - end - end - - # GET /metacode_sets/1/edit - def edit - @metacode_set = MetacodeSet.find(params[:id]) - end - # POST /metacode_sets # POST /metacode_sets.json def create @@ -57,15 +28,10 @@ class MetacodeSetsController < ApplicationController @metacodes.each do |m| InMetacodeSet.create(metacode_id: m, metacode_set_id: @metacode_set.id) end - format.html do - redirect_to metacode_sets_url, - notice: 'Metacode set was successfully created.' - end format.json do render json: @metacode_set, status: :created, location: metacode_sets_url end else - format.html { render action: 'new' } format.json { render json: @metacode_set.errors, status: :unprocessable_entity } end end @@ -97,10 +63,8 @@ class MetacodeSetsController < ApplicationController InMetacodeSet.create(metacode_id: m, metacode_set_id: @metacode_set.id) end - format.html { redirect_to metacode_sets_url, notice: 'Metacode set was successfully updated.' } format.json { head :no_content } else - format.html { render action: 'edit' } format.json { render json: @metacode_set.errors, status: :unprocessable_entity } end end @@ -117,7 +81,6 @@ class MetacodeSetsController < ApplicationController @metacode_set.destroy respond_to do |format| - format.html { redirect_to metacode_sets_url } format.json { head :no_content } end end