Hello,
How may I execute direct SQL in code?
Thanks
| SitePoint Sponsor |



Hello,
How may I execute direct SQL in code?
Thanks
You need to use find_by_sql
Code:def self.find_by_url (url_title_variable = "index") find_by_sql ["select * from pages where url_title = ?", url_title_variable] end





There is also MyModel.connection.select("Whatever SQL query you want right here")
as shown to me here: http://www.sitepoint.com/forums/show...06#post2232921
Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?



Thanks sam and vinnie. Both helped![]()
Bookmarks