Class: FestivityEventPage

Inherits:
FestivityBasePage show all
Includes:
Concerns::FestivityArtistMethods
Defined in:
app/models/festivity_event_page.rb

Instance Method Summary collapse

Methods included from Concerns::FestivityArtistMethods

#has_facebook?, #has_homepage?, #has_instagram?, #has_social?, #has_twitter?

Methods inherited from FestivityBasePage

#body, #sponsor_logo, #sponsor_logo?, #video, #video?

Instance Method Details

#can_buy?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/models/festivity_event_page.rb', line 27

def can_buy?
  !self.buy_url.empty?
end

#event_locationsObject



31
32
33
34
35
36
# File 'app/models/festivity_event_page.rb', line 31

def event_locations
  # Return array of unique locations
  self.performances.
      map{ |performance| performance.festivity_location_page }.
      uniq{ |location| location.id }
end

#festivity_performances=(performances) ⇒ Object



8
9
10
11
12
13
# File 'app/models/festivity_event_page.rb', line 8

def festivity_performances=(performances)
  performances.each do |performance|
    performance_id = performance.delete(:performance_id)
    FestivityPerformance.find(performance_id).update_attributes(performance)
  end
end

#locationsObject



23
24
25
# File 'app/models/festivity_event_page.rb', line 23

def locations
  @locations ||= event_locations
end

#performancesObject



15
16
17
# File 'app/models/festivity_event_page.rb', line 15

def performances
  self.festivity_performances.select {|perf| perf.festivity_location_page && perf.start_date && perf.end_date }
end

#single_location?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/festivity_event_page.rb', line 19

def single_location?
  @single_location ||= self.locations.count == 1
end