Resting Pug logo Resting Pug

Description

Gets a subject model from a controller class name

Tip

Override this method if you want to use another model.

Used in

Example

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a subject_model to use Novel as a model
  def subject_model
    Novel
  end
end

Source code

# lib/resting_pug/subject.rb

def subject_model
  controller_name.classify.constantize
end
Find me on GitHub