A bit more info after poking around. The following query doesn't work: SalesFact.first( :select => 'sales_facts.asking_price, on_market_date_dimensions.datetime, sale_date_dimensions.datetime, address_dimensions.street_name', :joins => [:on_market_date_dimension, :sale_date_dimension, :address_dimension])
(i.e. a three-way join on the three foreign keys of a SalesFact record, and only selecting specific columns in the result). Here's the SQL it generates, which fails because there is no on_market_date_dimensions table: SELECT sales_facts.asking_price, on_market_date_dimensions.datetime, sale_date_dimensions.datetime, address_dimensions.street_name FROM `sales_facts` INNER JOIN `date_dimensions` ON `date_dimensions`.id = `sales_facts`.on_market_date_dimension_id INNER JOIN `date_dimensions` sale_date_dimensions_sales_facts ON `sale_date_dimensions_sales_facts`.id = `sales_facts`.sale_date_dimension_id INNER JOIN `address_dimensions` ON `address_dimensions`.id = `sales_facts`.address_dimension_id LIMIT 1 I thought the point of @Andrius's approach was to give the model enough info so that it would refer to the date_dimension table and not the (non-existent) on_market_date_dimension table. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

