small medium large xlarge

29 Nov 2010, 02:50
Aaron mcLeod (13 posts)

Was just running the functionals at the end of Task E, just to ensure my changes didnt break any thing. I get the following error:

1) Error: test_should_show_cart(CartsControllerTest): ActionView::Template::Error: undefined method t_a' for #<Class:0x000001030eadb8> /Users/aaronmcleod/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:in method_missing’

My test method is the default created from the scaffold:

test “should show cart” do get :show, :id => @cart.to_param assert_response :success end

I noticed in the fixture that the objects there are just an empty hash in the yml file, since there are no columns to be populated. Any suggestions on how to fix?

29 Nov 2010, 03:23
Aaron mcLeod (13 posts)

Found out the answer. I ran into an error when going to the show view of the cart. I had a method in the cart.rb file that had the following typo:

def total_price line_items.t_a.sum { |item| item.total_price } end

as supposed to

def total_price line_items.to_a.sum { |item| item.total_price } end

You must be logged in to comment