sql - Rails get records using date ranges -


this question has answer here:

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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -