# Code that controller and view can access

**URL:** <https://www.ruby-forum.com/t/code-that-controller-and-view-can-access/123364>\
**Category:** Rails\
**Created:** [December 17, 2007, 3:26am UTC](https://www.ruby-forum.com/t/code-that-controller-and-view-can-access/123364 "2007-12-17T03:26:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 17, 2007, 3:26am UTC](https://www.ruby-forum.com/t/code-that-controller-and-view-can-access/123364/1 "2007-12-17T03:26:08Z")

</div>

Is there a way I can make a function be accessible by both the  
controller and the view?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 17, 2007, 3:58am UTC](https://www.ruby-forum.com/t/code-that-controller-and-view-can-access/123364/2 "2007-12-17T03:58:55Z")

</div>

On 17 Dec 2007, at 02:24, Mike C wrote:

> Is there a way I can make a function be accessible by both the  
> controller and the view?

class MyController \< ActionController::Base

def some\_method  
end

helper\_method :some\_method  
end

Fred
