Class: Spotlight::FeaturedImage
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spotlight::FeaturedImage
- Defined in:
- app/models/spotlight/featured_image.rb
Overview
Featured images for browse categories, feature pages, and exhibits
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#document ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/spotlight/featured_image.rb', line 24 def document return unless document_global_id && source == 'exhibit' if @document && document_global_id != @document.to_global_id.to_s @document = nil end @document ||= GlobalID::Locator.locate document_global_id rescue Blacklight::Exceptions::RecordNotFound => e Rails.logger.info("Exception fetching record by id: #{document_global_id}") Rails.logger.info(e) nil end |
#remote_image_url=(url) ⇒ Object
17 18 19 20 21 22 |
# File 'app/models/spotlight/featured_image.rb', line 17 def remote_image_url=(url) # if the image is local, this step will fail.. # hopefully it's local because it's an uploaded resource, and we'll # catch is in before_validation.. super url unless url.starts_with? '/' end |