Domanda

Is it possible to use my own application layout file in my main rails app instead of spree's? I have my main app already setup with devise and then added spree. Spree frontend uses

frontend/app/views/spree/layouts/spree_application.html.erb

in its own gem as its layout and I read how to override that file with my own in app/overrides or Deface, but I don't want to duplicate the content that is already in my app/views/layouts/application.html.erb.

I'm looking to use my own file instead or overriding spree's.

È stato utile?

Soluzione

You have 2 options:

  1. Create a app/view/spree/layouts/spree_application.html.erb in your rails app and rails will pick your file
  2. Set your own layout with Spree::Config[:layout] in an initializer (ex: Spree::Config[:layout]='application')

Altri suggerimenti

Spree::Config[:layout]='application' worked for me. But when I tried to switch to the spree default layout by removing this line, it did not work. After spending almost an hour I was able to switch back to default Spree::Config[:layout]='spree/layouts/spree_application' Adding this answer just in case someone else gets stuck with similiar error.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top