Method: Admin::BooksController#resources

Defined in:
lib/generators/dummy/templates/controllers/admin/books_controller.rb

#resourcesObject



7
8
9
10
11
12
13
14
15
# 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