Hey Everyone,
I'm trying to get backgroundrb running and I would consider myself an
intermediate rails programmer. I have the following controller method that I
would like to move to a worker method, but I'm not sure how to properly call
it from my controller once I place it in the worker method. Any advice or
help would be appreciated. Due to the fact I am still learning, code
examples would be awesome, but not necessary. I can usually get things
figured out given enough time.
Thanks!
Chris
def download_reads
if fields_mapped?
mapped_fields.each do |row|
ActiveRecord::Base.connection.execute(
"insert into readings(reading,
date,
year,
accounting_period,
account_id,
water_usage,
created_at,
updated_at)
values ('#{row[0]}',
'#{row[1]}',
'#{row[2]}',
'#{row[3]}',
'#{row[4]}',
'#{row[5]}',
'#{Time.current.to_s(:db)}',
'#{Time.current.to_s(:db)}');")
end
flash[:notice] = 'Water Readings Have Been Downloaded'
redirect_to :action => :download
else
end
rescue MapFields::InconsistentStateError
flash[:error] = 'Please try again'
redirect_to :action => :download
rescue MapFields::MissingFileContentsError
flash[:error] = 'Please upload a file'
redirect_to :action => :download
end
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel