I have a standalone Ruby script that downloads web pages, scrapes data from
these downloaded pages, and stores the results in a Postgres database.
This script is to run nightly. (My project is called Bargain Stock Funds.
This database stores data on mutual funds and ETFs.)

I am working on a Rails web site that needs to read data from this Postgres
database and display information on selected mutual funds and/or ETFs..

How do I work with a database that already exists? The tutorials and
examples out there seem to focus on creating a database rather than working
with a pre-existing one.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/uncHTL9GMMMJ.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Scott Ribe at Apr 20, 2013 at 3:04 am

    On Apr 19, 2013, at 5:15 PM, Jason Hsu, Android developer wrote:

    I have a standalone Ruby script that downloads web pages, scrapes data from these downloaded pages, and stores the results in a Postgres database. This script is to run nightly. (My project is called Bargain Stock Funds. This database stores data on mutual funds and ETFs.)

    I am working on a Rails web site that needs to read data from this Postgres database and display information on selected mutual funds and/or ETFs..

    How do I work with a database that already exists? The tutorials and examples out there seem to focus on creating a database rather than working with a pre-existing one.
    If your database is structured the way rails wants it, there's nothing more to do than define a model for each table.

    If your table names are not named the way Rails would name them, there's a method you use in the model class to specify the name.

    If you primary key field is not named id, there's a method...

    And so on for many other things.

    If you do not have an integer primary key, then things get difficult.

    But if you have integer primary keys on each table, then really you just need to be looking at the model class docs to figure out how to handle your tables.

    --
    Scott Ribe
    scott_ribe@elevated-dev.com
    http://www.elevated-dev.com/
    (303) 722-0567 voice




    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedApr 19, '13 at 11:16p
activeApr 20, '13 at 3:04a
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase