Class: FavouriteObject::FavouritesController

Inherits:
BaseFavouritesController
  • Object
show all
Defined in:
app/controllers/favourite_object/favourites_controller.rb

Instance Method Summary collapse

Instance Method Details

#collection_paginationObject



3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/favourite_object/favourites_controller.rb', line 3

def collection_pagination
	limit_per_page = params[:per_page] || 25
	@total_count = @favourites.count

	if params[:from] && !params[:from][:value].blank?
	  @favourites = @favourites.with_field_from(params[:from][:field], params[:from][:value], limit_per_page, params[:from][:order])
	else
	  @favourites = @favourites.limit(limit_per_page)
	end
end

#respond_to_methodObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/favourite_object/favourites_controller.rb', line 14

def respond_to_method
	respond_to do |format|
	  format.html
	  format.json {render :json => @favourites, 
	  	meta: { 
	  		deleted_ids: FavouriteObject::Favourite.show_deleted_ids(params[:visible_ids]),
	  		pagination: { total_objects: @total_count} 
	  	}
	  }
	end
end