自定义视图不在生产模式下加载,但在开发中加载 [英] Custom views not loading in production mode, but load in development

查看:52
本文介绍了自定义视图不在生产模式下加载,但在开发中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 spree 创建一个全新的前端(需要一组自定义标记和 JS,因此在这种情况下 Deface 不是一个好的选择).

I'm creating a completely new frontend for spree (need a custom set of markup and JS, so Deface isn't a good option in this case).

我覆盖的视图在开发中工作正常,但是一旦我在生产中加载它,它就会开始从核心和前端 gem 加载视图

The views I override work fine in development but once I load it up in production it starts to load the views from the core and frontend gems

我所有的覆盖都位于

app/views/spree/...

app/views/spree/...

但这在生产中都被忽略了,并且是从默认 gem 加载的.

But that is all ignored in production and is loaded from the default gems.

我在上面运行 Unicorn 和 Nginx.

I'm running Unicorn and Nginx on top.

有人知道这是怎么回事吗?

Anyone have the slightest idea what could be the case?

这是我的 Gemfile

This is my Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.13'

gem 'mysql2'
gem 'thin', '~> 1.5.1'
gem 'therubyracer', :platforms => :ruby
gem 'unicorn', '~> 3.6.2', :require => nil

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'jquery-rails', '~> 2.2.1'
  gem 'haml', '4.0.2'
  gem 'haml-rails', '0.4'
  gem 'swf_fu', '~> 2.0'
  gem 'uglifier', '>= 1.0.3'
end

gem 'spree', '2.0.3'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-0-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-0-stable'
gem 'spree_static_content', :github => 'spree/spree_static_content', :branch => '2-0-stable'

日志文件:

Started GET "/" for 127.0.0.1 at 2013-10-11 14:10:58 +0400
Processing by Spree::HomeController#index as HTML
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_taxonomies.html.erb (1.4ms)
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_products.html.erb (5.5ms)
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/home/index.html.erb within spree/layouts/spree_application (16.8ms)
  Rendered vendor/bundle/gems/spree_core-2.0.3/app/views/spree/shared/_routes.html.erb (0.9ms)
  Rendered spree/shared/_head.html.erb (11.9ms)
Deface: 1 overrides found for 'spree/shared/_nav_bar'
Deface: 'auth_shared_login_bar' matched 1 times with 'li#search-bar'
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_search.html.erb (2.7ms)
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_nav_bar.html.erb (10.2ms)
Deface: 1 overrides found for 'spree/shared/_main_nav_bar'
Deface: 'pages_in_header' matched 1 times with '#main-nav-bar'
Deface: [WARNING] No :original defined for 'pages_in_header', you should change its definition to include:
 :original => 'db2835f20e2ab66e854a74f6ae2a05cfb86f20fd' 
  Rendered spree/static_content/_static_content_list.html.erb (0.0ms)
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_main_nav_bar.html.erb (6.6ms)
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_header.html.erb (33.4ms)
Deface: 1 overrides found for 'spree/shared/_sidebar'
Deface: 'pages_in_sidebar' matched 1 times with '#sidebar'
Deface: [WARNING] No :original defined for 'pages_in_sidebar', you should change its definition to include:
 :original => 'd1fc4156cbab1ac52f706094ef49c096c6cc99c6' 
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_sidebar.html.erb (3.2ms)
Deface: 1 overrides found for 'spree/shared/_footer'
Deface: 'pages_in_footer' matched 1 times with '#footer-right'
Deface: [WARNING] No :original defined for 'pages_in_footer', you should change its definition to include:
 :original => '0e70b64f6d6eb3161e2de39b8253df9c0a201c63' 
  Rendered spree/static_content/_static_content_list.html.erb (0.0ms)
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_footer.html.erb (3.8ms)
  Rendered vendor/bundle/gems/spree_frontend-2.0.3/app/views/spree/shared/_google_analytics.html.erb (1.5ms)
Completed 200 OK in 124ms (Views: 117.4ms | ActiveRecord: 2.8ms)
Started GET "/assets/store/all-ca3b1f4927eae975c1f7c79787f2ca94.css" for 127.0.0.1 at 2013-10-11 14:10:58 +0400
Served asset /store/all-ca3b1f4927eae975c1f7c79787f2ca94.css - 304 Not Modified (0ms)
Started GET "/assets/store/all-f0bc96963b93c18206d8e0486f8ea783.js" for 127.0.0.1 at 2013-10-11 14:10:58 +0400
Served asset /store/all-f0bc96963b93c18206d8e0486f8ea783.js - 304 Not Modified (0ms)
Started GET "/assets/admin/bg/spree_50-ba6539ca1486ea7b446a777fa2d422ef.png" for 127.0.0.1 at 2013-10-11 14:10:58 +0400
Served asset /admin/bg/spree_50-ba6539ca1486ea7b446a777fa2d422ef.png - 304 Not Modified (0ms)
Started GET "/assets/admin/bg/spree_50-ba6539ca1486ea7b446a777fa2d422ef.png" for 127.0.0.1 at 2013-10-11 14:12:06 +0400
Served asset /admin/bg/spree_50-ba6539ca1486ea7b446a777fa2d422ef.png - 304 Not Modified (0ms)

推荐答案

我找到了解决方案.我的 Spree 版本是 2.0 稳定版,它使用 Deface gem,它不能与 HAML 模板一起使用.我刚搬回 ERB.新版本的 Spree 可能已经必须支持 Haml.

I found the solution. My Spree version is 2.0 stable, аnd it uses Deface gem, which not working with HAML templates. I just moved back to the ERB. New versions of Spree probably already have to support Haml.

谢谢大家.

这篇关于自定义视图不在生产模式下加载,但在开发中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆