Extract constant to define investments per page
That way it's easier to stub in tests. It makes it easier to customize CONSUL to show a different number of investments per page as well.
This commit is contained in:
@@ -6,6 +6,8 @@ module Budgets
|
||||
include FlagActions
|
||||
include ImageAttributes
|
||||
|
||||
PER_PAGE = 10
|
||||
|
||||
before_action :authenticate_user!, except: [:index, :show, :json_data]
|
||||
|
||||
load_and_authorize_resource :budget, except: :json_data
|
||||
@@ -37,7 +39,7 @@ module Budgets
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
@investments = investments.page(params[:page]).per(10).for_render
|
||||
@investments = investments.page(params[:page]).per(PER_PAGE).for_render
|
||||
|
||||
@investment_ids = @investments.pluck(:id)
|
||||
@investments_map_coordinates = MapLocation.where(investment: investments).map(&:json_data)
|
||||
|
||||
Reference in New Issue
Block a user