# View helpers in extensions

**URL:** <https://www.ruby-forum.com/t/view-helpers-in-extensions/88927>\
**Category:** Radiant CMS\
**Created:** [March 15, 2007, 5:56pm UTC](https://www.ruby-forum.com/t/view-helpers-in-extensions/88927 "2007-03-15T17:56:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![laserwhit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@laserwhit](https://www.ruby-forum.com/u/laserwhit)\
**Post date:** [March 15, 2007, 5:56pm UTC](https://www.ruby-forum.com/t/view-helpers-in-extensions/88927/1 "2007-03-15T17:56:57Z")

</div>

I’m still working on my asset handling plugin and I find myself needing  
a  
traditional rails helper method; i.e., something that I can call from a  
page view and use to dynamically modify/insert stuff into the page. I’ve  
been trying to add this functionality by creating a helper module (let’s  
call it “assets\_helper.rb”) to assist my controller (let’s call it  
“assets\_controller.rb”).

My helper is found in the following path

```
  /radiant_app/extensions/assets/app/helpers/assets_helper.rb

```

but for some reason it doesn’t seem to be loaded when the rest of the  
radiant app starts … none of the methods defined in it are available  
to  
my views.

Is this a known problem, or am I just doing something wrong? Any  
guidance  
would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![laserwhit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@laserwhit](https://www.ruby-forum.com/u/laserwhit)\
**Post date:** [March 15, 2007, 6:09pm UTC](https://www.ruby-forum.com/t/view-helpers-in-extensions/88927/2 "2007-03-15T18:09:59Z")

</div>

I ran into a similar issue earlier (I’m porting the Mephisto asset  
manager  
over to Radiant extensions) and would be very interested in an answer to  
the  
same question.

Along the same lines, I’d also like to be able to extend the overall  
application helper and application.rb from within an extension - is this  
possible?

Thanks,  
Kevin A.

On 3/15/07, Nathan W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> /radiant_app/extensions/assets/app/helpers/assets_helper.rb
> 
> ```
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
BN23 Search Limited is Registered in England  
Company Number: 5323555  
VAT registration Number: 896 69 0062

BN23 Search Limited  
Temple Grove  
Compton Place Road  
Eastbourne  
East Sussex  
BN20 8AD

---

<div class="post-metadata">

**Author:** ![laserwhit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@laserwhit](https://www.ruby-forum.com/u/laserwhit)\
**Post date:** [March 15, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/view-helpers-in-extensions/88927/3 "2007-03-15T19:30:10Z")

</div>

Nathan W. wrote:

> but for some reason it doesn’t seem to be loaded when the rest of the  
> radiant app starts … none of the methods defined in it are available to  
> my views.

You know, I don’t think we are doing anything special right now to  
ensure that helpers are loaded. Probably we have to notify Rails of the  
new helper directories, but we aren’t doing that right now.

Could you investigate a little more and let us know what we need to do?

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![laserwhit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@laserwhit](https://www.ruby-forum.com/u/laserwhit)\
**Post date:** [March 15, 2007, 11:50pm UTC](https://www.ruby-forum.com/t/view-helpers-in-extensions/88927/4 "2007-03-15T23:50:54Z")

</div>

On 3/15/07, John W. Long [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Could you investigate a little more and let us know what we need to do?

“app/helpers” are added to default load paths on app init:  
[http://dev.rubyonrails.org/browser/trunk/railties/lib/initializer.rb?rev=6293#L551](http://dev.rubyonrails.org/browser/trunk/railties/lib/initializer.rb?rev=6293#L551)  
[http://dev.rubyonrails.org/browser/trunk/railties/lib/initializer.rb?rev=6293#L133](http://dev.rubyonrails.org/browser/trunk/railties/lib/initializer.rb?rev=6293#L133)

You should do the same manually with your helpers directory… or teach  
Radiant extension system how to do it for you
