I tried to define default_scope as follows:
default_scope :joins => :product, :select => "catalog_products.*, products.*"
What I get from Rails, but here's what:
SELECT catalog_products.* FROM `catalog_products` INNER JOIN `products` ON `products`.id = `catalog_products`.product_id
When I define it as named_scope, everything is fine:
named_scope :extended, :joins => :product, :select => "catalog_products.*, products.*"
SELECT catalog_products.*, products.* FROM `catalog_products` INNER JOIN `products` ON `products`.id = `catalog_products`.product_id
Is this a mistake or is this the correct behavior?
I am using Rails 2.3.4.
Thanks!
source
share