Sha256: f7c2db01ca7057c705d7c7b5efbd86fc9608c7ff3852370e90e349d62e4e6196

Contents?: true

Size: 661 Bytes

Versions: 6

Compression:

Stored size: 661 Bytes

Contents

class FeaturedWorksController < ApplicationController
  def create
    authorize! :create, FeaturedWork
    @featured_work = FeaturedWork.new(generic_file_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(generic_file_id: params[:id])
    @featured_work.destroy

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sufia-6.7.0 app/controllers/featured_works_controller.rb
sufia-6.6.1 app/controllers/featured_works_controller.rb
sufia-6.6.0 app/controllers/featured_works_controller.rb
sufia-6.5.0 app/controllers/featured_works_controller.rb
sufia-6.4.0 app/controllers/featured_works_controller.rb
sufia-6.3.0 app/controllers/featured_works_controller.rb