activerecord to write to database

14 views
Skip to first unread message

Marcio Pugina

unread,
May 20, 2013, 6:36:59 PM5/20/13
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Hassan Schroeder

unread,
May 20, 2013, 9:16:58 PM5/20/13
to rubyonra...@googlegroups.com
On Mon, May 20, 2013 at 3:36 PM, Marcio Pugina <li...@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.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Reply all
Reply to author
Forward
0 new messages