Any idea why I cant pass parameter value for the find_by_sql query ?
simple example below wont work:
loginid = "demo"
sql = 'SELECT * FROM users where ownerid = "loginid"'
Read up on your ruby. How's ruby to know that loginid refers to a
variable rather than just the string loginid.
#{} and connection.quote are your friend.
But before you do that, why on earth are you using find_by_sql?
ImItem.find :all, :conditions => {:ownerid => loginid}
is easier to understand and you have less chance of shooting yourself
in the foot.