我正在关注Spree deface覆盖开发人员指南:http://guides.spreecommerce.com/developer/deface_overrides_tutorial.html
我的代码完全匹配它们,但我一直收到这个错误.我环顾四周,但我没有看到其他人遇到这个问题或类似的东西:
Spree:模块的未定义方法`content_tag'
我正在运行Rails 4.0.2和ruby 1.9.3(有可能教程没有更新为rails 4?)
这是我的代码:
应用程序/重写/ add_sale_price_to_product_edit.rb
Deface::Override.new(:virtual_path => 'spree/admin/products/_form',
:name => 'add_sale_price_to_product_edit',
:insert_after => "erb[loud]:contains('text_field :price')",
:text => "
<%= f.field_container :sale_price do %>
<%= f.label :sale_price, raw(Spree.t(:sale_price)) %>*
<%= f.text_field :sale_price, :value =>
number_to_currency(@product.sale_price, :unit => '') %>
<%= f.error_message_on :sale_price %>
<% end %>
")
应用程序/模型/大礼包/ product_decorator.rb
module Spree Product.class_eval do delegate_belongs_to :master, :sale_price end end
gmacdougall.. 6
您收到错误是因为未指定Spree.t(:sale_price)的翻译.这是失败的,因为Rails 4.0.2 对I18n API进行了一些更改.你有几个选择.
添加缺失标记的翻译,并记住此content_tag问题是由这个疯狂的错误引起的.
降级到Rails 4.0.0(不推荐)
将狂欢升级到2-1稳定分支(或等到2.1.4发布)
应用这一变化对当地的狂欢安装.它应该纠正这个问题.
任何这些应该让你再次工作.
您收到错误是因为未指定Spree.t(:sale_price)的翻译.这是失败的,因为Rails 4.0.2 对I18n API进行了一些更改.你有几个选择.
添加缺失标记的翻译,并记住此content_tag问题是由这个疯狂的错误引起的.
降级到Rails 4.0.0(不推荐)
将狂欢升级到2-1稳定分支(或等到2.1.4发布)
应用这一变化对当地的狂欢安装.它应该纠正这个问题.
任何这些应该让你再次工作.