Posted by
Twols
on
September 17, 2010
Use the Question Mark to set the params of the query to prevent SQL Injections.
Unsafe
Product.where("alias = '#{params[:alias]}'")
Safe
Product.where("alias = ?", params[:alias])
ActiveRecord will sanitize the given params.

Comments
This example can be written like "Product.where(:alias => params[:alias])" too.