StudxXxent wrote:> What I need to do is write a ruby application (one for each sql
> statement), where the sql statement is hardcoded into the ruby code.
> I need the ruby code to:
> 1) connect to the oracle database
> 2) run the sql statement on the oracle database
> 3) take the results and return them in an array or
> something of that nature (so that they can be used in an html file for
> output on the web application)
You need to learn about ActiveRecord. This is too large a subject for a
quick answer on a forum.
Start with Rails tutorials. Take the time to understand how they are
using ActiveRecord, how the models relate to database tables and how the
#find method works for extracting data, including uses of #has_many,
#belongs_to and #has_one for linking models and use of :includes in the
#find method for doing implicit joins on tables.
Search for information about ActiveRecord to take you further. It
sounds like you are trying to fit Rails to an existing database schema,
so google for "rails activerecord legacy schema" and you should get a
few sites with advice on ways to access existing schemas from rails.
The ActiveRecord reference is available starting here:
http://api.rubyonrails.com/classes/ActiveRecord/Base.html
however this is a reference and probably will only be useful as such
alongside tutorials and other material.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---