Class: Restaurants::Picture::ActiveRecord_Associations_CollectionProxy

Inherits:
Object
  • Object
show all
Defined in:
app/models/restaurants/picture.rb

Overview

Customize restaurant.pictures methods

Instance Method Summary collapse

Instance Method Details

#coverObject



117
118
119
# File 'app/models/restaurants/picture.rb', line 117

def cover
  covers.try(:first)
end

#coversObject



121
122
123
124
125
126
# File 'app/models/restaurants/picture.rb', line 121

def covers
  restaurant = first.try(:restaurant)
  return nil if restaurant.nil?

  order_by_priority.select(&:has_cover_tag?)
end

#except_coverObject



128
129
130
131
132
133
# File 'app/models/restaurants/picture.rb', line 128

def except_cover
  restaurant = first.try(:restaurant)
  return [] if restaurant.nil?

  order_by_priority.reject(&:has_cover_tag?)
end