Method: AdminAssistant::Index::RecordFinder#run

Defined in:
lib/admin_assistant/index.rb

#runObject



143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/admin_assistant/index.rb', line 143

def run
  @ar_query = ARQuery.new(
    :order => order_sql, :include => find_include,
    :per_page => settings.per_page, :page => @index.url_params[:page]
  )
  add_base_condition_sqls
  search.add_to_query @ar_query
  @ar_query.total_entries = optimized_total_entries
  records = @index.model_class.paginate(@ar_query.to_hash)
  if caching_total_entries? && @ar_query.to_hash[:total_entries].nil?
    cache_total_entries records.total_entries
  end
  records
end