Class: Sunrise::ActivitiesController

Inherits:
ApplicationController show all
Includes:
Utils::SearchWrapper
Defined in:
app/controllers/sunrise/activities_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/sunrise/activities_controller.rb', line 7

def index
  per_page = Sunrise::Config.activities_per_page
  cur_page = (params[:page] || 1).to_i
  offset = (cur_page - 1) * per_page
  
  @events = Sunrise.activities
  @events = @events.limit(per_page).offset(offset)

  respond_with(@events) do |format|
    format.html { render :layout => params[:time].blank? }
  end
end