Join GitHub today
Habtm collection_singular_ids bug with :include #678
Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/4662
This is my first ticket, so be gentle :)
Summary: when I use
class Product < ActiveRecord::Base has_and_belongs_to_many :vendors, :include => :state end class Vendor < ActiveRecord::Base has_and_belongs_to_many :products belongs_to :state end class State < ActiveRecord::Base has_many :vendors end
v = Vendor.create p = Product.create p.vendors << v p.vendor_ids #works as expected, returns [v.id] Product.find(p.id).vendor_ids #re-fetch the product and try again **ActiveRecord::MissingAttributeError: missing attribute: state_id** p = Product.find(p.id) p.vendors #force an association load p.vendor_ids #works as expected, returns [v.id]
It only occurs if you try and access the
I just tested that code with a new, clean 2.3.5 app with just the classes above, and I get the errors as described.
If i need to include any other info please let me know!