Module: EnjuEvent::EnjuLibrariesController

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/enju_event/enju_libraries_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/concerns/enju_event/enju_libraries_controller.rb', line 5

def show
  search = Sunspot.new_search(Event)
  library_id = @library.id
  search.build do
    with(:library_id).equal_to library_id
    order_by(:start_at, :desc)
  end
  page = params[:event_page] || 1
  search.query.paginate(page.to_i, Event.default_per_page)
  @events = search.execute!.results
end