Newbie - best place to put methods used in controllers?

Hey guys,

Where is the best place to put methods called in your controller? I ask
because my controller file is getting bulky with code that doesnt need
to be called directly.

I was wondering if I could put it in the application.rb or if there is
some way to put it in the helper?

On 7/30/06, Eric G. [email protected] wrote:

Posted via

Rails mailing list
[email protected]

The code that is not called directly may be better placed into a module
your lib directory. The actions that get called on the controller as an
action should certainly go into the controller in 99.99% of situations.

You can put code into the application helper, but this is generally for

IMHO this is simply put as:

If a method is data integrity related, try and put it in the model.

If a method only exists to support the flow of the controller logic, put
in a controller.

If a method is there to assist with displaying content, stick it in a

With any/all of these, modules are always available.

It’s a bit hard to know what advice to give with such a small ammount of

Hope that helps