Description
Gets a subject model from a controller class name
Tip
Override this method if you want to use another model.
Used in
- #subject_model_sym
- #subject_model_sym_plural
- #create_subject
- #fetch_subject
- #fetch_subjects
- Params#permitted_fields
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