Sha256: fca52b72fbe18077fb1c46b1079e01175f524fc93834ec52ce892378b55ddb56

Contents?: true

Size: 616 Bytes

Versions: 3

Compression:

Stored size: 616 Bytes

Contents

class Kuroko2::StarsController < Kuroko2::ApplicationController
  def create
    star = Kuroko2::Star.new do |star|
      star.job_definition = Kuroko2::JobDefinition.find(star_params[:job_definition_id])
      star.user           = current_user
    end

    if (star.save)
      render json: star, status: :created
    else
      raise Http::BadRequest
    end
  end

  def destroy
    star = Kuroko2::Star.find(params[:id])

    if (star.destroy)
      render json: star, status: :ok
    else
      raise Http::BadRequest
    end
  end

  private

  def star_params
    params.permit(:job_definition_id)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kuroko2-0.8.0 app/controllers/kuroko2/stars_controller.rb
kuroko2-0.7.0 app/controllers/kuroko2/stars_controller.rb
kuroko2-0.6.0 app/controllers/kuroko2/stars_controller.rb