Class: Spree::TaxonImage

Inherits:
Asset
  • Object
show all
Defined in:
app/models/spree/taxon_image.rb,
app/models/spree/taxon_image/configuration/paperclip.rb,
app/models/spree/taxon_image/configuration/active_storage.rb

Defined Under Namespace

Modules: Configuration

Instance Method Summary collapse

Methods inherited from Base

belongs_to_required_by_default, page, spree_base_scopes

Methods included from Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

#stylesObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/spree/taxon_image.rb', line 6

def styles
  self.class.styles.map do |_, size|
    width, height = size[/(\d+)x(\d+)/].split('x')

    {
      url: polymorphic_path(attachment.variant(resize: size), only_path: true),
      width: width,
      height: height
    }
  end
end