Displaying 1 result from an estimated 1 matches for "fixcontrol".
Did you mean:
fitcontrol
2010 Mar 18
5
One-time script to update 1000s of values in a single column in a table: nil error?
...oller called fix_controller.rb. I don''t have access to the live
system, so the idea is that an admin will go to http://url/fix and a
script will run to check and potentially update the "strength" value
for every record in the stocks table.
fix_controller.rb
^^^^^^^^^^^^^^^
class FixController < ApplicationController
def index
stocks = Stock.find(:all)
stocks.each do |s|
if s.strength.nil? || s.strength == ''''
puts ''nothing to update''
else
s.update_units
end
end
end
end
Stock.rb
^^^^^^...