Re: [Rails] How to relate model with self value?

2010-12-16 Thread Peter Vandenabeele
On Wed, Dec 15, 2010 at 3:24 PM, Masuda wrote: > I'm developing with ruby-1.9. 1 rails 3.0.0. > I want to relate 'User' model and 'Payment' model with condition which > has the same value as 'user.testing' in 'payment.testing' > > I did > > Class User < ActiveRecord::Base >    has_many payments, :

[Rails] How to relate model with self value?

2010-12-15 Thread Masuda
Hi, I'm developing with ruby-1.9. 1 rails 3.0.0. I want to relate 'User' model and 'Payment' model with condition which has the same value as 'user.testing' in 'payment.testing' I did Class User < ActiveRecord::Base has_many payments, :conditions => ['testing = ?', self.testing] end This doe