Kannan
(Kannan)
1
Hi,
@table_names = TableName.find(:all, :conditions=>{:column_name => params[:gm], :column_id => params[:id]})
Here, I used two conditions to find SQL. This two conditions applies with “AND”. I need to apply this two conditions with “OR” condition.
Applying “|” or "||"symbol fails… How I can apply OR condition, Kinldy help me.
Colin_Law1
(Colin Law)
2
Hi,
@table_names = TableName.find(:all, :conditions=>{:column_name =>
params[:gm], :column_id => params[:id]})
Here, I used two conditions to find SQL. This two conditions applies with
"AND". I need to apply this two conditions with "OR" condition.
Use the array form for conditions
@table_names = TableName.find(:all, :conditions=>[ 'column_name = ? OR
column_id = ?', params[:gm], params[:id] ])
Colin
Kannan
(Kannan)
3
Dear Collin…
Wooww… Excellent… Tanx @ extreme. I too tried with many examples obtained from online forums… This made me fun…