Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change spree application layout file to load

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.

like image 520
Chris Avatar asked Feb 17 '14 22:02

Chris


2 Answers

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')
like image 192
Cristian Bica Avatar answered Sep 27 '22 23:09

Cristian Bica


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.

like image 25
Saurabh Avatar answered Sep 27 '22 23:09

Saurabh