Spree category pages in custom rails app

2019-08-29 07:50发布

问题:

I have created a default rails app. I am beginner to spree.

I am not able to find the code for the pages which are coming by default in the spree app.

This is how I have created the app

gem install rails -v 4.2.2
gem install bundler
gem install spree_cmd
rails _4.2.2_ new mystore
cd mystore
spree install --auto-accept

When I go to http://localhost:3000/t/categories/bags I get all the categories for this category.

But in my view I do not see any code. So from where are these coming from?

Please help.

回答1:

it is coming from spree gems, you can see the front end code by opening the gem file in your editor by following. (you need to set you environment variables EDITOR or BUNDLER_EDITOR)

bundle open spree_frontend 

or else you can do in terminal

bundle show spree_frontend
open 'path above something like  /Users/xyz/.rvm/gems/ruby-2.2.3/gems/spree_frontend-3.0.8'


回答2:

These pages come from within the Spree gem, which adds routes and views. Have a poke around and see what you find here: https://github.com/spree/spree/tree/master/core/app

It runs as a Rails engine, so read up on how that works here if you want to know how the gem adds routes: http://guides.rubyonrails.org/engines.html



回答3:

See rails request/response log to find the rendered partials path in a request.

Also you may find http://guides.spreecommerce.com/developer/view.html helpful.