Closed Znow closed 11 years ago
I will look into this for you.
This is now resolved with 0.4.3.
There was an issue with the way the a multi stock quote was returning... Old: [[{stock_data}], [{stock_data}]] Now: [{stock_data}, {stock_data}]
Please let me know if this resolves your issue!
Thanks alot man, great support!
Ill try it out later today and give you a notice.
Sorry, but the problem persists
rake aborted!
undefined method `[]' for nil:NilClass
/home/action/workspace/advicecapital/lib/tasks/stock_info_update.rake:28:in `block (2 levels) in <top (required)>'
/home/action/workspace/advicecapital/lib/tasks/stock_info_update.rake:27:in `each'
/home/action/workspace/advicecapital/lib/tasks/stock_info_update.rake:27:in `block in <top (required)>'
/home/action/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/home/action/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => stock_info_update
(See full trace by running task with --trace)
That is because hash
is nil, in this case you are not using key
so you can just simply run:
stock_data.each do |stock|
stockdata = StockData.where(:symbol => stock[:symbol]).last
if stockdata.present?
stockdata.update_attributes(:price => stock[:price], :change => stock[:change],:volume => stock[:volume])
end
end
I am going to close this issue, please reopen if you need additional help with getting the gem to run.
Hi, since you have pushed a new version, you have changed the usual Ystock.find to Ystock::Yahoo.quote etc.
All though, my rake task used to work just fine, until I upgraded to the newest version.
rake aborted!'
undefined method
[]' for nil:NilClass /home/action/workspace/advicecapital/lib/tasks/stock_info_update.rake:28:in
block (2 levels) in <top (required)>'/home/action/workspace/advicecapital/lib/tasks/stock_info_update.rake:27:in
each' /home/action/workspace/advicecapital/lib/tasks/stock_info_update.rake:27:in
block in <top (required)>'/home/action/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in
eval' /home/action/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in
Tasks: TOP => stock_info_update
(See full trace by running task with --trace)
This is very urgent! I need the fix ASAP!
Atm, im running at version 0.3.8 just for getting this to work.