Topic: Help with ActiveRecord::Base.execute(sql)
I have a query that I need to run as a raw sql query against a "legacy" Oracle database. I have not been able to find a complete example of doing such and being very new to this I'm lost. I'm already set up to talk to the Oracle database as other parts of my app are working fine.
Can I just create a new file, my_query.rb, under the models folder like below?
[code = ruby]
sql = "my complex sql statement"
ActiveRecord::Base.execute(sql)
[/code]
Then what? I feel like I'm missing something. How do I access the rows returned by my query?
Sorry if this is a simple task, my background is in writing SQL not programming code. I am making some progress though.
Thanks.