Resting Pug logo Resting Pug

Description

Destroys a subject and render nothing or errors

Tip

Override this method to add some custom logic to destroying process.

Used in

Use

Example

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a destroy_subject to destroy only if title is not 'None'
  def destroy_subject
    if @subject.title != 'None' && @subject.destroy
      render_nothing
    else
      render_errors
    end
  end
end

Source code

# lib/resting_pug/subject.rb

def destroy_subject
  if @subject.destroy
    render_nothing
  else
    render_errors
  end
end
Find me on GitHub