Class: Restaurants::Picture
Defined Under Namespace
Classes: ActiveRecord_Associations_CollectionProxy
Constant Summary
collapse
- TAGS =
{
cover: { name: 'Cover', max: 'unlimited' },
front: { name: 'Restaurant Front', max: 'unlimited' },
dining_area: { name: 'Dining Area', max: 'unlimited' },
recommended_menu: { name: 'Recommended Menu', max: 'unlimited' },
other_add_dishes: { name: 'Other Additional Dishes', max: 'unlimited' },
beverage: { name: 'Beverage', max: 'unlimited' },
bar: { name: 'Bar', max: 'unlimited' },
music_stage: { name: 'Music Stage', max: 'unlimited' },
view_from_seat: { name: 'View from Seating', max: 'unlimited' },
amenities: { name: 'Other Amenities', max: 'unlimited' },
others: { name: 'Others', max: 'unlimited' },
photos: { name: 'Photos', max: 'unlimited' },
menus: { name: 'Menus', max: 'unlimited' },
}.freeze
Instance Method Summary
collapse
sync_carrierwave_url
Instance Method Details
#cached_tag_list ⇒ Object
51
52
53
54
55
|
# File 'app/models/restaurants/picture.rb', line 51
def cached_tag_list
return [] if self[:cached_tag_list].blank?
@cached_tag_list ||= ActsAsTaggableOn::GenericParser.new(self[:cached_tag_list].to_s).parse
end
|
#has_cover_tag? ⇒ Boolean
69
70
71
|
# File 'app/models/restaurants/picture.rb', line 69
def has_cover_tag?
cached_tag_list.include?('cover')
end
|
#set_priority ⇒ Object
57
58
59
60
61
62
63
|
# File 'app/models/restaurants/picture.rb', line 57
def set_priority
return true if priority.present?
list = cached_tag_list.presence || tag_list
images_in_same_tags = Restaurants::Picture.tagged_with(list.first).where(restaurant_id: restaurant_id).count
self.priority = images_in_same_tags + 1
end
|
#source ⇒ Object
65
66
67
|
# File 'app/models/restaurants/picture.rb', line 65
def source
foursquare_id.present? ? 'foursquare' : 'hungryhub'
end
|