Skip to content

Commit

Permalink
get rid of unused code in reps_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
msimonborg committed May 8, 2017
1 parent 8987e29 commit 8de63a5
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions app/controllers/reps_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# frozen_string_literal: true

class RepsController < ApplicationController
acts_as_token_authentication_handler_for User, only: %i[create update destroy]
before_action :set_rep, only: %i[show update destroy]
after_action :make_impression, only: [:index]
before_action :set_rep, only: :show
after_action :make_impression, only: :index
has_scope :independent,
:republican,
:democrat,
Expand All @@ -29,37 +28,8 @@ def index
# GET /reps/1
def show; end

# POST /reps
def create
@rep = Rep.new(rep_params)

if @rep.save
render json: @rep, status: :created, location: @rep
else
render json: @rep.errors, status: :unprocessable_entity
end
end

# PATCH/PUT /reps/1
def update
if @rep.update(rep_params)
render json: @rep
else
render json: @rep.errors, status: :unprocessable_entity
end
end

# DELETE /reps/1
def destroy
@rep.destroy
end

private

def rep_params
params.require(:rep).permit(:id, :bioguide_id)
end

# Use callbacks to share common setup or constraints between actions.
def set_rep
@rep = Rep.find_by(bioguide_id: params[:id])
Expand Down

0 comments on commit 8de63a5

Please sign in to comment.