So I have two different models one called numbers which is structured like this
t.string :number
t.date :texted
t.integer :times
t.timestamps
and one called Users (I only included the relevant portion)
t.string :phone_number
t.timestamps
What I need to do is grab all numbers that the texted date is more than 2 weeks ago and times is less than 4 and that t.string :number is not equal to any t.string :phone_number in the users table. Do I need to do some sort of sql join to accomplish this?
This is what I have so far:
numbers = Onumber.where("texted <= ? AND times<=4",2.week.ago.utc)