lib/snaptable/constructor/collection.rb in snaptable-1.1.3 vs lib/snaptable/constructor/collection.rb in snaptable-1.2.0
- old
+ new
@@ -5,10 +5,10 @@
def collection
@collection.includes(belongs_to_associations)
end
def records
- @records ||= filter(collection).paginate(page: params[:page], per_page: 30).order(sort_column + " " + sort_direction)
+ @records ||= filter(collection).paginate(page: params[paginate_key], per_page: 30).order(sort_column + " " + sort_direction)
end
def filter(collection)
if options[:search] == true && !params[:query].blank?
collection.joins(search_associations).where(query, query: "%#{params[:query]}%", id: params[:query].to_i)