Resting Pug logo Resting Pug

Description

Returns all subjects accessable for API

Tip

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

Used in

Use

Example

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a fetch_subjects to return subject where title is not 'None'
  def fetch_subjects
    @subjects = subject_model.where.not(title: 'None')
  end
end

Source code

# lib/resting_pug/subject.rb

def fetch_subjects
  @subjects = subject_model.all
end
Find me on GitHub