[Rails] Re: [ANN] Where Plugin

Jens-Christian Fischer jcf at invisible.ch
Tue Jan 3 09:31:23 GMT 2006


I just found a problem that I'm not sure how to solve:

Converting this:

Task.find(:all, :conditions => ['project_id = ?', self.id] )

to

Task.find_with_conditions(:all) do
   project_id '=', self.id
end

breaks horrible, because "self.id" in the block references god knows  
what (probably the Cond block) instead of the ActiveRecord object. A  
work around is to use a temporary variable:

id = self.id
Task.find_with_conditions(:all) do
   project_id '=', id
end

Hmm - not that nice. Any ideas on how to solve that?

jc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2361 bytes
Desc: not available
Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060103/bcb64c0e/smime.bin


More information about the Rails mailing list