views:

22

answers:

0

I expect found a bug in rails v2.3.8, but I'm asking here in case I'm just doing something stupid.

I have a 3-deep nested model that describes a shipment (i.e. shipment -> boxes -> line-items in boxes). The shipment and boxes are created at the same time, but the line-items already exist, from when the order was placed, so line-items just need to be associated with the box they are in.

The create method for shipment give me this error:

ActiveRecord::RecordNotFound (Couldn't find VendorOrderLine with ID=3 for VendorShippingBox with ID=)

And shows SQL it tried to execute:

SELECT * FROM "vendor_order_lines" WHERE ("vendor_order_lines"."id" IN ('3','4')) AND ("vendor_order_lines".vendor_shipping_box_id = NULL)

Notice that vendor_shipping_box_id is not in quotes.

If I run this query in the console with:

VendorOrderLine.find(:all, :conditions=>["vendor_order_lines.id IN ('3', '4') AND vendor_order_lines.vendor_shipping_box_id IS NULL"])

I get the expected result. Oddly enough, the update method works fine

I can post more details if needed, but the rails generated SQL should have vendor_shipping_box_id in quotations, and that's what's causing the ActiveRecord error, correct? Or am I missing something?

(note, my models/controllers/views are all setup per Ryan Bates' RailsCasts ep: 196 & 197)


UPDATE: I updated to Rails 3.0, and the create method works as expected. So this is definitely a bug. Is it proper to report a bug for previous versions of software? Where can I find documentation on rails bugs/bug reporting?