Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'factory_girl'
- Dir["spec/factories/*"].each{|f| require f}
- Factory.create :product
- #=> new product with id=12
- Product.first.update_versioned(:charge_interval => 'daily')
- #=> new product with id=13
- Product.all(:conditions => "id IN (select id from abstract_products group by name, edition having max(version))")
- #=> Finds 12 instead of 13
- Product.all(:conditions => 'version = (SELECT MAX(version) FROM abstract_products AS inner_abstract_products WHERE inner_abstract_products.name = abstract_products.name)')
- #=> Finds 13 correctly
Add Comment
Please, Sign In to add comment