# Cleaning up my methods

**URL:** <https://www.ruby-forum.com/t/cleaning-up-my-methods/133441>\
**Category:** Rails\
**Created:** [March 31, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/cleaning-up-my-methods/133441 "2008-03-31T17:51:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [March 31, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/cleaning-up-my-methods/133441/1 "2008-03-31T17:51:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [March 31, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/cleaning-up-my-methods/133441/2 "2008-03-31T18:30:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [March 31, 2008, 6:48pm UTC](https://www.ruby-forum.com/t/cleaning-up-my-methods/133441/3 "2008-03-31T18:48:11Z")

</div>

Read this:  
[http://wiki.rubyonrails.org/rails/pages/UnderstandingWhatMethodsGoWhere](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
