Skip to content

v3.0.0.rc2

Pre-release
Pre-release
Compare
Choose a tag to compare
@kennyadsl kennyadsl released this 10 Mar 15:02
3cc2d3e

This is the second pre-release of Solidus 3.0. Please let's give it a try and let us know if there are issues.

Preliminary Upgrade Guide

Follow these steps:

  1. Update to the last released version of Solidus v2.11 (as of today, it is 2.11.5).
  2. Be sure you have run the migrations installer with bin/rails railties:install:migrations and bin/rails db:migrate.
  3. Run the update task with bin/rails solidus:upgrade:two_point_eleven.
  4. Check your logs (either running your test suite or your production logs) and remove any deprecation warning. If you are using deprecated code, it is very likely that your application is not compliant with Solidus 3.0.
  5. Update your Gemfile to use gem 'solidus', '3.0.0.rc2', run bundle install.

Common Problems

Spree::Image customization

Error:

~/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.3/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `has_one_attached' for #<Class:0x00007fc91f548d38>
Did you mean?  has_attached_file (NoMethodError)

Cause

Spree::Image has now its default adapter to Active Storage, and you probably want to keep using the Paperclip adapter. This setting can be changed with:

# config/initializers/spree.rb`

config.image_attachment_module = 'Spree::Image::PaperclipAttachment'
config.taxon_attachment_module = 'Spree::Taxon::PaperclipAttachment'

Take care you don't have any customization of Spree::Image.attachment_definitions before setting that preference (even in other initializer files loaded before, eg config/initializers/paperclip.rb).

Solution

If you do, you'll see the error described above. To fix this, move the customization to a decorator, for example, if you have:

# config/intitializers/something.rb

 Spree::Image.attachment_definitions[:attachment][:styles] = {
   mini: '48x48>',
   small: '100x100>',
   product: '240x240>',
   large: '600x600>'
 }

Move it into:

# app/models/spree/images/customization_decorator.rb

# frozen_string_literal: true
module Spree
  module ImageDecorator
    class << self
      private

      def prepended(klass)
        klass.attachment_definitions[:attachment][:styles] = {
          mini: '48x48>',
          small: '100x100>',
          product: '240x240>',
          large: '600x600>'
        }
      end
    end

    Spree::Image.prepend self
  end
end

ActionCable JS inclusion

Error

ActionView::Template::Error: couldn't find file 'action_cable' with type 'application/javascript'

Cause

We are not requiring the whole rails/all bundle anymore in Solidus. See #3478.

Solution

Depending on if you are using ActionCable or not, you may want to manually require 'action_cable' in your config/application.rb or just remove //= require action_cable somewhere in your assets pipeline manifests.