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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -