sql - Rails get records using date ranges -
this question has answer here:
- rails reports can't find column there 3 answers
in rails application have table named jobtech , in table have 2 columns jobstartdate
, jobfinishdate
. want show job starting date today , jobs finishing date today. have tried lot things didn't solution.
can tell how this?
my table structure like:
class createjobteches < activerecord::migration def change create_table :job_teches |t| t.integer :job_id t.integer :technician_id t.date :jobstartdate t.time :jobstarttime t.date :jobfinishdate t.time :jobfinishtime t.integer :dueby t.integer :jobscheduled t.timestamps end end end
i have tried like:
jobtech.where("jobstartdate >= ? , jobfinishdate <= ?", date.yesterday, date.today)
try this
jobtech.where("jobstartdate = ? or jobfinishdate = ?", date.today, date.today)
hope helps :)
Comments
Post a Comment