Sha256: 13aefb54959e75dd0ddb02c5e8b0a82d340bd20c1343ec24382e6262219a2af7

Contents?: true

Size: 838 Bytes

Versions: 29

Compression:

Stored size: 838 Bytes

Contents

module Hyrax
  class FeaturedWorksController < ApplicationController
    def create
      authorize! :create, FeaturedWork
      @featured_work = FeaturedWork.new(work_id: params[:id])

      respond_to do |format|
        if @featured_work.save
          format.json { render json: @featured_work, status: :created }
        else
          format.json { render json: @featured_work.errors, status: :unprocessable_entity }
        end
      end
    end

    def destroy
      authorize! :destroy, FeaturedWork
      @featured_work = FeaturedWork.find_by(work_id: params[:id])
      if @featured_work
        # Handle the case where a separate request may have already
        # destroyed this work
        @featured_work.destroy
      end

      respond_to do |format|
        format.json { head :no_content }
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.3 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.1.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.1.0.rc4 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.1.0.rc3 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.1.0.rc2 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.1.0.rc1 app/controllers/hyrax/featured_works_controller.rb
hyrax-1.1.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.1.0.beta2 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.2 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.1.0.beta1 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.0.rc3 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.0.rc2 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.0.rc1 app/controllers/hyrax/featured_works_controller.rb
hyrax-1.0.5 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.0.beta5 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.0.beta4 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.0.0.beta3 app/controllers/hyrax/featured_works_controller.rb