Search code examples
ruby-on-rails-5spree

How to setup spree_static_content with spree 3.X and rails 5 to generate static pages


I have been trying to setup gem spree_static_content with spree 3.X and rails 5 but there are endless errors (migrations not running, gem dependencies) which are coming. Documentation is outdated and no help on any of the gems and spree commerce project. If someone has recently used these projects please share the debugging results.


Solution

  • When setting up spree_static_content gem with Rails 5.x and spree 3.x there are various errors you will get when you add only gem spree_static_content to your Gemfile. Install following gems to your Gemfile and you will not get any error and will easily setup cms for static content for your application.

    gem 'spree_static_content', github: 'spree-contrib/spree_static_content'
    
    gem 'globalize', git: 'https://github.com/globalize/globalize'
    gem 'activemodel-serializers-xml'
    
    gem 'spree_i18n', github: 'spree-contrib/spree_i18n'
    gem 'spree_globalize', github: 'spree-contrib/spree_globalize'
    

    Next, run following commands

    bundle install
    bundle exec rails g spree_i18n:install
    bundle exec rails g spree_globalize:install
    bundle exec rails g spree_static_content:install
    

    Now, simply create pages from admin but don't forget to select the store-name checkbox for route to work for spree 3.x.