search for: account_ref

Displaying 1 result from an estimated 1 matches for "account_ref".

2009 Apr 21
0
Validate order lines on order creation (ActiveResource)
...y lines. I would like to create order only when all order lines will be created: require ''rubygems'' require ''activeresource'' class PurchaseOrder < ActiveResource::Base self.site = "http://admin:secret@localhost:23456" end o = PurchaseOrder.create(:account_ref => ''123'', :lines => [{ :code => "111" }, {:code => "222"}]) puts o.inspect If I add validation that code has to be <200, then the PurchaseOrder should never be created. The problem is, I am not aware of the rails way of doing it :) I started d...