Leo Lukin
Leo Lukin

Reputation: 1211

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

When I try to add item to cart or just to get /cart I get error ("controller"=>"spree/orders", "action"=>"edit"):

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

I use

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

How can I fix this?

Some info on request:

 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

Upvotes: 0

Views: 504

Answers (2)

Miotsu
Miotsu

Reputation: 1776

I have the same problem whenever I happen to override a view, both from scratch and using Deface. My guess is that it's a namespace problem and my not recommended solution is to simply remove the Spree. part. It works.

Upvotes: 0

westonplatter
westonplatter

Reputation: 1495

You need to either

1) explicitly call the t method through the Spree module (IE, Spree.t(:login), more on that here http://guides.spreecommerce.com/developer/i18n.html#translating-views)

2) or install the https://github.com/spree/spree_i18n gem if it's not included in 1-2-stable

Upvotes: 1

Related Questions