Sha256: 0a963a3f710314e9ed3c927f5a1c2bf9f62f3db06817f4f24d515aead53b245a
Contents?: true
Size: 756 Bytes
Versions: 13
Compression:
Stored size: 756 Bytes
Contents
class Admin::EventsController < Admin::ResourceController paginate_models :per_page => 20 prepend_before_filter :get_venue def load_models pp = pagination_parameters finder = @event_venue ? Event.at_venue(@event_venue) : Event.scoped({}) unless params[:p] first_event = finder.future_and_current.first i = finder.index(first_event) || 0 # if there are no future events we revert to the first page p = (i / pp[:per_page].to_i) + 1 pp[:page] = p if p && p > 1 end self.models = finder.paginate(pp) end protected def get_venue @event_venue = EventVenue.find_by_id(params[:event_venue_id]) if params[:event_venue_id] Rails.logger.warn "@event_venue is #{@event_venue.inspect}" end end
Version data entries
13 entries across 13 versions & 1 rubygems