开发者

Why "has_many :line_items, :dependent => destroy" in the cart.rb model file causing failed tests

开发者 https://www.devze.com 2023-01-04 19:17 出处:网络
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 th

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. 开发者_JAVA技巧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


has_many :line_items, :dependent => :destroy

I think destroy is a symbol

0

精彩评论

暂无评论...
验证码 换一张
取 消