0

当我尝试将商品添加到购物车或只是为了获取 /cart 时出现错误(“controller”=>“spree/orders”、“action”=>“edit”):

undefined method `t' for #<Object:0x007fcf73c3de40>

我用

gem 'spree', :github => "spree/spree", :branch => "1-2-stable"
gem 'rails', '3.2.13'

我怎样才能解决这个问题?

应要求提供的一些信息:

 Request parameters 
    {"controller"=>"spree/orders", "action"=>"edit"}
    Rack session    
    {"session_id"=>"27fa800c8ce44449aa52e1dd12f8a00d", "_csrf_token"=>"oyxFyT2w3bBnslMMTodMXu1/+mK4BFlxBt/yoVyx8wk=", "access_token"=>"4445ad766b7af28b", "order_id"=>1090, "warden.user.user.key"=>[[1], "x6tiNUojzd5fny1uzefx"], "guest_token"=>nil, "spree_user_signup"=>nil}
    Local Variables

    haml_temp   
    nil
    _hamlout    
    #<Haml::Buffer:0x007fcf7b411f48 @active=true, @upper=nil, @options={:autoclose=>["meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base"], :preserve=>["textarea", "pre", "code"], :attr_wrapper=>"'", :ugly=>false, :format=>:html5, :encoding=>"UTF-8", :escape_html=>false, :escape_attrs=>true, :hyphenate_data_attrs=>true, :cdata=>false}, @buffer="", @tabulation=0, @real_tabs=1>
    _erbout 
    ""
    scope   
    #<Binding:0x007fcf7b4127e0>
    locals  
    {}
    block   
    nil
    parent  
    nil
    buffer  
    #<Haml::Buffer:0x007fcf7b411f48 @active=true, @upper=nil, @options={:autoclose=>["meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base"], :preserve=>["textarea", "pre", "code"], :attr_wrapper=>"'", :ugly=>false, :format=>:html5, :encoding=>"UTF-8", :escape_html=>false, :escape_attrs=>true, :hyphenate_data_attrs=>true, :cdata=>false}, @buffer="", @tabulation=0, @real_tabs=1>
    scope_object    
    #<Object:0x007fcf7b419158 @_haml_locals={:_hamlout=>#<Haml::Buffer:0x007fcf7b411f48 @active=true, @upper=nil, @options={:autoclose=>["meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base"], :preserve=>["textarea", "pre", "code"], :attr_wrapper=>"'", :ugly=>false, :format=>:html5, :encoding=>"UTF-8", :escape_html=>false, :escape_attrs=>true, :hyphenate_data_attrs=>true, :cdata=>false}, @buffer="", @tabulation=0, @real_tabs=1>, :_erbout=>""}, @haml_buffer=nil>
    e   
    nil
    Instance Variables

    @_haml_locals   
    {:_hamlout=>#<Haml::Buffer:0x007fcf7b411f48 @active=true, @upper=nil, @options={:autoclose=>["meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base"], :preserve=>["textarea", "pre", "code"], :attr_wrapper=>"'", :ugly=>false, :format=>:html5, :encoding=>"UTF-8", :escape_html=>false, :escape_attrs=>true, :hyphenate_data_attrs=>true, :cdata=>false}, @buffer="", @tabulation=0, @real_tabs=1>, :_erbout=>""}
    @haml_buffer    
    nil
4

2 回答 2

1

你需要要么

1)通过模块显式调用t方法Spree(IE Spree.t(:login),更多关于这里http://guides.spreecommerce.com/developer/i18n.html#translating-views

2) 或安装https://github.com/spree/spree_i18n gem,如果它不包含在1-2-stable

于 2013-08-19T23:16:36.353 回答
0

每当我碰巧覆盖视图时,我都会遇到同样的问题,无论是从头开始还是使用 Deface。我的猜测是这是一个命名空间问题,我不推荐的解决方案是简单地删除该Spree.部分。有用。

于 2013-08-25T08:37:21.050 回答