app/controllers/v1/spin_candidates_controller.rb
def publish
      #puts "User is"+ current_user.inspect
      sc = SpinCandidate.find(params[:spin_candidate_id])
      spin = sc.spin || Spin.new(full_name: sc.full_name, user: sc.user, spin_candidate: sc)
      unless current_user == sc.user
        render_error_exchange(:spin_candidate_not_owner, :not_allowed)
        return
      end
      if sc
        if sc.publish_spin user: current_user
          return_response sc, :ok, {}
        else
          render_error_exchange(:spin_candidate_not_validated, :precondition_failed)
        end
      else
        render_error_exchange(:spin_candidate_not_found, :not_found)
      end
      # If valid create or update the Spin
      # If not valid, the log should be updated.
    end
# Publish the SpinCandidate into a Spin
# @returns :ok or :error
Publish the SpinCandidate into a Spin
Publish the SpinCandidate into a Spin
def publish
      sc = SpinCandidate.find(params[:spin_candidate_id])
      spin = sc.spin || Spin.new(full_name: sc.full_name, user: sc.user, spin_candidate: sc)
      unless current_user == sc.user
        render_error_exchange(:spin_candidate_not_owner, :not_allowed)
        return
      end
      if sc
        if sc.publish_spin user: current_user
          return_response sc, :ok, {}
        else
          render_error_exchange(:spin_candidate_not_validated, :precondition_failed)
        end
      else
        render_error_exchange(:spin_candidate_not_found, :not_found)
      end
    end
def publish sc = SpinCandidate . find ( params [ :spin_candidate_id ] ) spin = sc . spin || Spin . new ( full_name : sc . full_name , user : sc . user , spin_candidate : sc ) unless current_user == sc . user render_error_exchange ( :spin_candidate_not_owner , :not_allowed ) return end if sc if sc . publish_spin user : current_user return_response sc , :ok , { } else render_error_exchange ( :spin_candidate_not_validated , :precondition_failed ) end else render_error_exchange ( :spin_candidate_not_found , :not_found ) end end
Publish the SpinCandidate into a Spin
Publish the SpinCandidate into a Spin
#puts "User is"+ current_user.inspect # If valid create or update the Spin # If not valid, the log should be updated.
:ok or :error
: ok or : error