Forum: Ruby on Rails activerecord to write to database

3145e241ad278a3681f33febe8608149?d=identicon&s=25 Marcio Pugina (mpugina84601)
on 2013-05-21 00:36
I created a db with rake migrate and added to columns, symbol and
cur_price in a table call Financials. I want to use activererecord from
a script to write the data from the script to the database. Could
someone please provide an example.

Model:
class Financials < ActiveRecord::Base
  attr_accessible :symbol, :cur_price


Ruby Script parameters:

symbols = [ 'csco","c","bac"

cur_prices = ['10','20','30']


Thanks in advance
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2013-05-21 03:18
(Received via mailing list)
On Mon, May 20, 2013 at 3:36 PM, Marcio Pugina <lists@ruby-forum.com>
wrote:
> I created a db with rake migrate and added to columns, symbol and
> cur_price in a table call Financials. I want to use activererecord from
> a script to write the data from the script to the database. Could
> someone please provide an example.

See:   rails runner --help

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.