I am using this file-uploader for ruby on rails. I upload some files with numbers for statistical analysis. Model for the files is called filedb.In filedb.rb the file is opened and numbers are analysed(some correlation stuff and etc.). After that I need so save the results into a table called results.
Will it be clever just to write in filedb.rb:
@cell=Results.new(:cell_name =>filenames, :icorrelation=>intensities)
@cell.save
Or it is better to use results_controller to create a record in a table? and to to something like this: results_controller.rb:
def create
@result = Result.new(params[:result])
if @result.save
lalala
else
render :new
end
end
Though I do not know how to pass arguments :result to a controller
Thanks in advance
edit:
filedbs_controller.rb:
def analyse
(filedb.where(analyse:no)).perform_analysis
respond_to do |format|
format.html { redirect_to :back }
end
end
filedb.rb
def self.perform_analysis
list=Analysis.do_number_analyse
if list!=nil
results(list)
end
end
def self.results(list)
do somthing with list
cell=Results.new(:cell_name =>filenames, :icorrelation=>intensities)
cell.save
end
Analysis.do_number_analyse - is a method in another model, where all calculations are done