views:

17

answers:

1

Why

has_many :line_items, :dependent => destroy

in the cart.rb model file causing failed tests

I have been working through the "Agile Web Development with Rails" book and am about half way through the depot application (I did skip around a bit).

When I go to run the default test ("the truth") I get failed tests. Trace says

"/Users/username/Documents/rails_projects/depot/app/models/cart.rb:2:in `destroy': wrong number of arguments (0 for 1) (ArgumentError) from /Users/username/Documents/rails_projects/depot/app/models/cart.rb:2"

If I comment that line out I no longer get the error message and the tests pass. But I don't understand the error message.

What should I be looking at? Is this a valid failure that I need to fix somehow?

Thanks

+3  A: 

has_many :line_items, :dependent => :destroy

I think destroy is a symbol

DrColossos
I am new to RoR can you explain further?Is that line incorrect? Or should it be something else?I got it from the agile book. I thought the line was saying any dependent items should be destroyed.
Maestro1024
@Maestro1024: You just forgot a `:`, that's all.
j.