Skip to content

Instantly share code, notes, and snippets.

@Frank004
Created December 9, 2015 20:58
Show Gist options
  • Save Frank004/a8f4aeb0d15606059684 to your computer and use it in GitHub Desktop.
Save Frank004/a8f4aeb0d15606059684 to your computer and use it in GitHub Desktop.
@users = User.all
@user.each do |u|
u.name
u.tasks do |t| <---------- I like to do check where task start_date is in a range of date
t.name
end
end
@ziggythehamster
Copy link

alternatively

u.tasks.where("start_date BETWEEN ? AND ?", 1.week.ago, Time.current).each do |t|

@neutronz
Copy link

neutronz commented Dec 9, 2015

👍

@Frank004
Copy link
Author

Frank004 commented Dec 9, 2015

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment