[Rails] Re: Working with Legacy database

Eric Anderson eric at afaik.us
Wed Jan 5 19:20:20 GMT 2005


Eric Anderson wrote:
> But this doesn't work either because the sql string is evaluated at the 
> time the macro is executed so the method name() and foo() are not 
> evaluated on the actual object we are running the search on.

Just figured out the solution. The finder_sql option is interpolated 
while in the context of the object. So if I pass it a single quoted 
string it will delay interpolation and work how I want.

The docs didn't explicitly say it does this although the example the 
docs give show the delayed interpolation.

Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://one.textdrive.com/pipermail/rails/attachments/20050105/99638ccd/signature-0001.bin


More information about the Rails mailing list