app/models/spree/image_decorator.rb
module Spree module ImageDecorator module ClassMethods def styles { mini: '48x48>', small: '100x100>', product: '240x240>', large: '600x600>', } end end def self.prepended(base) base.inheritance_column = nil base.singleton_class.prepend ClassMethods end end Image.prepend(ImageDecorator) end
<%= image_tag(main_app.url_for(@product.images.first.attachment.variant(resize: '150x150'))) %>
Was this page helpful?