You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I finished upgrading Spina from 0.12 to 1.0.3 along with upgrading Rails from 5.0.x to 5.2.x and there are some issues which are not documented and which the upgrade gem does not address.
This issue is meant more like a documentation of what should be done, so others don't lose time with resolving same problems.
(OPTIONAL): If you're often dropping your development/test DB and just wish to re-create it and run migrations, you will need to fix an old migration from Spina 0.x called CreateSpinaTranslationTables . Replace it with the following:
Prior to running the rails g spina:upgrade command, you will need to create a migration with the following:
def change
create_table :spina_images do |t|
t.integer :media_folder_id
t.timestamps
end
add_index :spina_images, :media_folder_id
create_table :spina_resources do |t|
t.string :name, null: false, unique: true
t.string :label
t.string :view_template
t.integer :parent_page_id
t.string :order_by
t.timestamps
end
add_column :spina_pages, :resource_id, :integer, null: true
add_index :spina_pages, :resource_id
add_index :spina_resources, :parent_page_id
create_table :spina_image_collections do |t|
t.timestamps
end
create_table :spina_image_collections_images, id: :serial, force: :cascade do |t|
t.integer :image_collection_id
t.integer :image_id
t.integer :position
end
add_index :spina_image_collections_images, :image_collection_id
add_index :spina_image_collections_images, :image_id
end
You will also need to create an initializer for Mobility, so in config/initializers, add a mobility.rb with the following:
Mobility.configure do |config|
config.default_backend = :table
config.accessor_method = :translates
config.query_method = :i18n
end
If you haven't been using ActiveStorage before, make sure you configure everything.
Run rails g spina:upgrade which will create another migration file, run all your pending db migrations, run a rake file to handle the breaking change regarding Spina Image and you should get Upgrade done
Replace Spina::Photo with Spina::Image as mentioned in the docs and make the necessary changes to your templates where you use images, your image handling should now look something like this:
<% if @page.content(:image)&.file&.attached? %>
<%= image_tag(@page.content(:image).file.service_url, alt: @page.title) %>
<% end %>
That's it, grab a beer and have fun.
The text was updated successfully, but these errors were encountered:
I finished upgrading Spina from
0.12
to1.0.3
along with upgrading Rails from 5.0.x to 5.2.x and there are some issues which are not documented and which the upgrade gem does not address.This issue is meant more like a documentation of what should be done, so others don't lose time with resolving same problems.
gem 'ruby-progressbar'
to your Gemfile.CreateSpinaTranslationTables
. Replace it with the following:rails g spina:upgrade
command, you will need to create a migration with the following:Mobility
, so inconfig/initializers
, add amobility.rb
with the following:If you haven't been using ActiveStorage before, make sure you configure everything.
Run
rails g spina:upgrade
which will create another migration file, run all your pending db migrations, run a rake file to handle the breaking change regarding Spina Image and you should getUpgrade done
Replace
Spina::Photo
withSpina::Image
as mentioned in the docs and make the necessary changes to your templates where you use images, your image handling should now look something like this:The text was updated successfully, but these errors were encountered: