Lan
Lan

Reputation: 6149

Is there an alternative for `proxy_options` now that it's been removed? rails

In rails 2 you could use proxy_options to see the options for specific database queries. In rails 3 it has been removed. Is there a different option for getting this same info?

Upvotes: 3

Views: 993

Answers (2)

Henrik N
Henrik N

Reputation: 16274

I only now learned of a nicer way. Undocumented but nice:

User.joins(:address).merge(Address.foreign)

as an alternative to

User.joins(:address).where(Address.foreign.where_values)

Upvotes: 1

adzdavies
adzdavies

Reputation: 1555

I posted a long answer here: How to test a scope in Rails 3

But the main answer is use #where_values_hash or #to_sql on your scope.

Upvotes: 2

Related Questions