[Rails] Where to put require 'gem' statements?

2010-02-19 Thread Martin Berli
Hello, I've seen all sorts of places where people put their 'require' statements, and I'm not sure what the best solution is. I'm currently using it directly in a model/csv_processor.rb: require 'fastercsv' class CsvProcessor def self.create_csv_table(file) ... FCSV.parse(...

[Rails] Re: Where to put large application controller code

2010-02-08 Thread Martin Berli
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 standalon

[Rails] Re: Where to put large application controller code

2010-02-07 Thread Martin Berli
Sharagoz -- wrote: > Code that doesn't fit neatly into a model, view or controller, or that > is shared across multiple models, views or controllers, should be > extracted into a module most of the time, and included where it needs to > be. Thanks, that's really what I needed. To put all the c

[Rails] Re: Where to put large application controller code

2010-02-07 Thread Martin Berli
Sharagoz -- wrote: > If your controllers are getting fat it might be an indication that you > are putting a lot of the logic in the wrong place and not using the MVC > architecture the way its ment to be used. "Skinny controller, fat model" > is the practice most try to follow. The "calculation

[Rails] Where to put large application controller code

2010-02-07 Thread Martin Berli
Hello, A common experience: You start to develop a new rails application. When controller method code is growing, you will put parts of its code under the private section at the end of the controller, because you want the public methods to reflect the processing logic, not the calculation detail.