Users Pricing

forum

Query Between Two Tables Using Ruby

Anonymous User 2840 18 May 2013
Hi Guys! 

How to used query between two table in rub?

I'm trying as following

contact = UserContact.find(:all,:select=>"distinct app_id,number",:conditions=>"number ='1234'")

arr=[]
contact.each do|c|
 arr << c.app_id
name=User.find(:all,:conditions=>"id in(#{arr.join(',')}")
I takes two much time Can i do this using join

Please help!
Thanks in advance!

I am a content writter !


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md