On Apr 25, 2:41 am, Juan Pablo Avello xua...@gmail.com wrote:
Or, if phone nos. are different:
phones = [['31', '32221'0412'], ['32','422020202']].map{|q|
phones.area_code = #{q[0]} and phones.number = #{q[1]}}.join(' or ')
Lawyer.includes(:phones).where(phones)
That one could lead to
Hi,
Phone.find(:all, :conditions=[area_code in ? and number in
?,(555,533),(533,12345678)])
Regards,
Vishal Singh
Ruby On Rails Developer
On Tue, Apr 24, 2012 at 11:07 AM, Rafael C. de Almeida almeida...@gmail.com
wrote:
On Apr 24, 1:55 am, vishal singh vishal.singh...@gmail.com wrote:
El martes, 24 de abril de 2012 03:56:21 UTC+2, Rafael C. de Almeida
escribió:
Hello
I have two tables: Lawyer and Phone. Phone is separated into area code
and number. A lawyer has many phones. I want to produce a query which
searches for lawyers who have a phone matching a phone from a
On Apr 24, 6:06 am, Juan Pablo Avello xua...@gmail.com wrote:
El martes, 24 de abril de 2012 03:56:21 UTC+2, Rafael C. de Almeida
escribió:
Hello
I have two tables: Lawyer and Phone. Phone is separated into area code
and number. A lawyer has many phones. I want to produce a query which
On Apr 24, 5:34 am, vishal singh vishal.singh...@gmail.com wrote:
Hi,
Phone.find(:all, :conditions=[area_code in ? and number in
?,(555,533),(533,12345678)])
That wouldn't work. That would match the phone
{area_code:'533',number:'533'}. I want to match only (555, 533) or
(533, 12345678).
--
Phone.where(area_code in (?) and number in (?), [440,441,443],
[23233233,23231212,12121212])
2012/4/24 Rafael C. de Almeida almeida...@gmail.com
On Apr 24, 5:34 am, vishal singh vishal.singh...@gmail.com wrote:
Hi,
Phone.find(:all, :conditions=[area_code in ? and number in
On Apr 24, 2:55 pm, Rogerio Medeiros arge...@gmail.com wrote:
Phone.where(area_code in (?) and number in (?), [440,441,443],
[23233233,23231212,12121212])
That would match phone (440) 12121212. In that situation, I'd like to
match (440) 23233233, (441) 23231212 and (443) 12121212. However I
How about using concatenation in your query?
Walter
On Apr 24, 2012, at 1:11 PM, Rafael C. de Almeida almeida...@gmail.com
wrote:
On Apr 24, 2:55 pm, Rogerio Medeiros arge...@gmail.com wrote:
Phone.where(area_code in (?) and number in (?), [440,441,443],
[23233233,23231212,12121212])
phones = [{area_code:'31', number:'32210412'},
{area_code:'32', number:'32210412'}]
lawyers = []
phones.each do |phone|
lawyer Lawyer.joins(:phones).where('phones.area_code = ? and
phones.number ', phone.area_code, phone.number)
end
2012/4/24 Walter Lee Davis wa...@wdstudio.com
How about
On Apr 24, 3:24 pm, Rogerio Medeiros arge...@gmail.com wrote:
phones = [{area_code:'31', number:'32210412'},
{area_code:'32', number:'32210412'}]
lawyers = []
phones.each do |phone|
lawyer Lawyer.joins(:phones).where('phones.area_code = ? and
phones.number ', phone.area_code,
On 24 April 2012 20:32, Rafael C. de Almeida almeida...@gmail.com wrote:
On Apr 24, 3:24 pm, Rogerio Medeiros arge...@gmail.com wrote:
phones = [{area_code:'31', number:'32210412'},
{area_code:'32', number:'32210412'}]
lawyers = []
phones.each do |phone|
lawyer
On Apr 24, 1:55 am, vishal singh vishal.singh...@gmail.com wrote:
hi,
Make a two model, Lawyer and Phone then in lawyer model add has_any :phones
and in phone model add belongs_to :lawyer
then find lawler like
@lawyer = Lawyer.find(1) 1 is id in lawyer table
then write
12 matches
Mail list logo