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

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/15 17:52:51
ruby 例如 :conditions => [

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]