Aleksey Gureiev wrote: > I'm sorry, looked at the wrong page and didn't notice the ongoing > discussion. > > As you could see, I second that you don't need fat controllers and > that CSV processing logic belongs to a CSVProcessor model (not > module). It doesn't have a table, but it is a standalone entity that > knows how to work with data. Isolate your code in it, test it with > unit tests and call from your skinny controller. > > - Aleksey
So you suggest to create a class app/models/csv_processor.rb which does the job? Which also contains "require 'fastercsv'"? Would you make a singleton of it, as it makes no sense to have several instances? Otherwise in my controller, I would have to write cp = CsvProcessor.new csv_table = cp.create_csv_table(params[:file_ref]) I'd prefer not to have to create an instance here, and just use csv_table = CsvProcessor.create_csv_table(params[:file_ref]) Does this make sense? - Martin -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

