Cleaning up my methods

Hi, I’m trying to clean up my methods and especially my controllers as
they’re getting pretty bloated.

Got a question, am I right in thinking that any methods I put into the
inididual models are only accesible from their corresponding
controllers?

With the Helpers, any methods I put in there, can I use them in the
views?, looks like I can only use them in the controllers?

Want to move some of the methods I’m using for the views outside
/controllers/application.rb as it’s getting pretty unmanageable.

Any ideas?

On 31 Mar 2008, at 16:51, John G. wrote:

Hi, I’m trying to clean up my methods and especially my controllers as
they’re getting pretty bloated.

Got a question, am I right in thinking that any methods I put into the
inididual models are only accesible from their corresponding
controllers?

No. There isn’t really a strong association between controllers and
models. if you’ve got a method on a model class you can call it
whenever you have an instance of the class at hand (unless of course
you make that method protected/private)

With the Helpers, any methods I put in there, can I use them in the
views?, looks like I can only use them in the controllers?
By default helper methods are only available to views

Want to move some of the methods I’m using for the views outside
/controllers/application.rb as it’s getting pretty unmanageable.

You may find it helps to group related methods in modules and include
those in relevant controllers.

Read this:
http://wiki.rubyonrails.org/rails/pages/UnderstandingWhatMethodsGoWhere

That said. I have dozens upon dozens of methods I use in globally.
Currently, I am in the process of moving those out of
application_helper and into subfiles that are included at the top (My
app helper was getting huge). That way I can logically organize them,
but they are still available everywhere. I hope this helps.

H