ruby 例如 :conditions => ["name = and product_id = "]

来源:学生作业帮助网 编辑:六六作业网 时间:2024/05/27 10:19:06
ruby例如:conditions=>["name=andproduct_id="]ruby例如:conditions=>["name=andproduct_id="]ruby例如:condition

ruby 例如 :conditions => ["name = and product_id = "]
ruby 例如 :conditions => ["name = and product_id = "]

ruby 例如 :conditions => ["name = and product_id = "]
这个就相当于 是 sql的 条件语句啊
上面的 就相当于 where name = and product_id=
这里的问号 就相当于 sql语句的预处理
:conditions => ["name = and product_id = "]
这个应该 是需要给两个预处理参数
:conditions => ["name = and product_id = ",params[:name],params[:product_id]]
正常的语句 是 select * from product where name =params[:name] and product_id= params[:product_id]