Class: EventVenuesController
- Inherits:
-
EventsController
- Object
- EventsController
- EventVenuesController
- Defined in:
- app/controllers/event_venues_controller.rb
Overview
We inherit from EventsController to share subsetting functionality All we do here is organise that information by venue.
Instance Method Summary collapse
-
#events ⇒ Object
event_finder is defined in EventsController.
-
#events_at_venue(venue) ⇒ Object
events are stashed in venue buckets to avoid returning to the database.
- #index ⇒ Object
- #slug_for_venue(venue) ⇒ Object
- #venues ⇒ Object
Instance Method Details
#events ⇒ Object
event_finder is defined in EventsController
22 23 24 |
# File 'app/controllers/event_venues_controller.rb', line 22 def events @events ||= all_events end |
#events_at_venue(venue) ⇒ Object
events are stashed in venue buckets to avoid returning to the database
32 33 34 |
# File 'app/controllers/event_venues_controller.rb', line 32 def events_at_venue(venue) venue_events[venue.id] end |
#index ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/event_venues_controller.rb', line 8 def index respond_to do |format| format.html { } format.js { render :layout => false } format.json { render :json => venue_events.to_json } end end |
#slug_for_venue(venue) ⇒ Object
36 37 38 39 40 |
# File 'app/controllers/event_venues_controller.rb', line 36 def slug_for_venue(venue) if events = venue_events[venue.id] events.first.calendar.slug end end |
#venues ⇒ Object
26 27 28 |
# File 'app/controllers/event_venues_controller.rb', line 26 def venues @venues ||= events.map(&:event_venue).compact.uniq end |