Skip to content

Commit

Permalink
remove CSRF check on observation check to temporarily allow POST/PATC…
Browse files Browse the repository at this point in the history
…H to observation API
  • Loading branch information
mjy committed May 2, 2017
1 parent 5950a1f commit 39e69f2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions app/controllers/observations_controller.rb
@@ -1,6 +1,8 @@
class ObservationsController < ApplicationController
include DataControllerConfiguration::ProjectDataControllerConfiguration

skip_before_filter :verify_authenticity_token

before_action :set_observation, only: [:show, :edit, :update, :destroy, :annotations]

# GET /observations
Expand Down Expand Up @@ -42,11 +44,11 @@ def create

respond_to do |format|
if @observation.save
format.html { redirect_to observation_path(@observation), notice: 'Observation was successfully created.' }
format.json { render :show, status: :created, location: @observation }
format.html { redirect_to observation_path(@observation.metamorphosize), notice: 'Observation was successfully created.' }
format.json { render :show, status: :created, location: @observation.metamorphosize }
else
format.html { render :new }
format.json { render json: @observation.errors, status: :unprocessable_entity }
format.json { render json: @observation.metamorphosize.errors, status: :unprocessable_entity }
end
end
end
Expand All @@ -57,10 +59,10 @@ def update
respond_to do |format|
if @observation.update(observation_params)
format.html { redirect_to @observation.metamorphosize, notice: 'Observation was successfully updated.' }
format.json { render :show, status: :ok, location: @observation }
format.json { render :show, status: :ok, location: @observation.metamorphosize }
else
format.html { render :edit }
format.json { render json: @observation.errors, status: :unprocessable_entity }
format.json { render json: @observation..metamorphosize.errors, status: :unprocessable_entity }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/observation.rb
Expand Up @@ -18,7 +18,7 @@ class Observation < ActiveRecord::Base
validate :otu_or_collection_object_set

def self.human_name
'YAY'
'YAY'
end

protected
Expand Down
2 changes: 1 addition & 1 deletion app/models/observation/qualitative.rb
Expand Up @@ -2,6 +2,6 @@ class Observation::Qualitative < Observation

belongs_to :character_state

validates_presence_of :character_state_id
validates_presence_of :character_state

end

0 comments on commit 39e69f2

Please sign in to comment.