狂欢错误:未定义的方法`t&#39; for#<object:0x007fcf73c3de40> </object:0x007fcf73c3de40>

时间:2013-07-16 10:22:50

标签: spree

当我尝试将商品添加到购物车或只是为了获取/购物车时我收到错误(“控制器”=&gt;“狂欢/订单”,“操作”=&gt;“编辑”):

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

2 个答案:

答案 0 :(得分:1)

你需要

1)通过t模块明确调用Spree方法(IE,Spree.t(:login),更多内容http://guides.spreecommerce.com/developer/i18n.html#translating-views}

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

答案 1 :(得分:0)

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