我正在关注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)) %><span>*</span>
<%= f.text_field :sale_price, :value =>
number_to_currency(@product.sale_price, :unit => '') %>
<%= f.error_message_on :sale_price %>
<% end %>
")
Run Code Online (Sandbox Code Playgroud)
应用程序/模型/大礼包/ product_decorator.rb
module Spree
Product.class_eval do
delegate_belongs_to :master, :sale_price
end
end
Run Code Online (Sandbox Code Playgroud)