class Admin::BooksController

Public Instance Methods

resources() click to toggle source
Calls superclass method
# File lib/generators/dummy/templates/controllers/admin/books_controller.rb, line 7
def resources
  relation = super

  relation = relation.where(active: true) if params[:only_active]
  relation = relation.where( 'published_at >= ?', params[:published_since]) if params[:published_since].present?
  relation = relation.where( 'published_at <= ?', params[:published_up_to]) if params[:published_up_to].present?

  relation
end
searchable_fields() click to toggle source
# File lib/generators/dummy/templates/controllers/admin/books_controller.rb, line 3
def searchable_fields
  [:title, :genre, author: [:name] ]
end