Open xu4wang opened 4 years ago
From the stack trace:
.... activerecord (6.0.2.2) lib/active_record/relation/finder_methods.rb:500:in
find_take' activerecord (6.0.2.2) lib/active_record/relation/finder_methods.rb:98:in
take' activerecord (6.0.2.2) lib/active_record/relation/finder_methods.rb:81:infind_by' spree_static_content (a1e066bc612d) lib/spree_static_content.rb:19:in
matches?' actionpack (6.0.2.2) lib/action_dispatch/routing/mapper.rb:40:inblock in matches?' actionpack (6.0.2.2) lib/action_dispatch/routing/mapper.rb:39:in
all?' actionpack (6.0.2.2) lib/action_dispatch/routing/mapper.rb:39:in `matches?' ....
Checked the source of lib/spree_static_content.rb,
It looks like the issue was introduced by commit 694bce534857cb4f85033a0689a9e9c0e03ec87a, "Make SpreeGlobalize optional" . The SpreeGlobalize didn't create spree_page_translations.
@damianlegawiec
checked the migration file of static_content gem, it did try to create the translation table.
This migration comes from spree_static_content (originally 20170827000001)
class AddTranslationToSpreePages < SpreeExtension::Migration[4.2] def up params = { title: :string, body: :text, slug: :string, foreign_link: :string, meta_keywords: :string, meta_title: :string, meta_description: :string } if defined?(SpreeGlobalize) Spree::Page.create_translation_table!(params, { migrate_data: true }) end end
def down if defined?(SpreeGlobalize) Spree::Page.drop_translation_table! migrate_data: true end end end
I understand the issue I'm facing is I install static_content gem first, and spree globalize gem later. Which makes the translation table not generated.
How shall I do? Is there a way to re-run the migration files and regenerate the translation table?
I just installed i18n and globalize gem, please find below the statement in my Gemfile
The spree_static_content was added before and working as expected. However after install i18n and globalize today, the pages can not work. I get error when accessing the pages tab on /admin with below information.
`Showing /Users/wangxu/.gem/ruby/2.7.0/bundler/gems/spree_static_content-a1e066bc612d/app/views/spree/admin/pages/index.html.erb where line #28 raised:
Mysql2::Error: Table 'myproject_development.spree_page_translations' doesn't exist`