Hi all,
I am investigating moving our app from Rails 2.2.2 to Rails 2.3.2. So
far doesn't look too bad, but I am running in to one problem.
In a model I have the following named scope:
named_scope :valid, {:include => :broker, :joins => 'INNER JOIN
`payers` ON `payers`.customer_id = `brokers`.id AND
`payers`.customer_type = \'Broker\'', :conditions => "payers.status =
'active' and ticket_sets.delete_flag = 0 and ticket_sets.qty > 0 and
(brokers.ei_id is NULL or (brokers.ei_id is not null and
ticket_sets.ei_id is not null)) "}
This worked perfectly in Rails 2.2.2, but in Rails 2.3.2 this blows up.
Looking at the log file, it appears that the :include clause isn't being
parsed.
SELECT `ticket_sets`.* FROM `ticket_sets` INNER JOIN `payers` ON
`payers`.customer_id = `brokers`.id AND `payers`.customer_type =
'Broker' WHERE (payers.status = 'active' and ticket_sets.delete_flag =
0 and ticket_sets.qty > 0 and (brokers.ei_id is NULL or (brokers.ei_id
is not null and ticket_sets.ei_id is not null)) )
If I remove the the joins clause, the brokers get included like they
should be, but it doesn't have payers referenced.
One option would be into use nested includes to include the payers; but
this has some serious performance issues. The ticket sets table is large
and we don't need to the payers data returned, just for selection.
Does anybody have any ideas?
Thanks,
Andrew
--
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
-~----------~----~----~----~------~----~------~--~---