ruby - Rails query WHERE clause using OR -


i have 2 individual rails queries both work fine on own:

@charts = chart.where(:patient_id => @emailpatient.id)  @charts = chart.where(:patient_id => @sharepatient.id) 

that want combine single 'or' query. tried:

@charts = chart.where(:patient_id => @sharepatient.id or :patient_id => @emailpatient.id) 

and

@charts = chart.where("patient_id => @sharepatient.id or patient_id => @emailpatient.id") 

and various other variations , cant work. going astray?

you can do

@charts = chart.where(:patient_id => [@emailpatient.id, @sharepatient.id]) 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -