# Using view helpers from a controller

**URL:** <https://www.ruby-forum.com/t/using-view-helpers-from-a-controller/118935>\
**Category:** Rails\
**Created:** [November 1, 2007, 3:04pm UTC](https://www.ruby-forum.com/t/using-view-helpers-from-a-controller/118935 "2007-11-01T15:04:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ldk2005](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d9b06d/32.png) [@ldk2005](https://www.ruby-forum.com/u/ldk2005)\
**Post date:** [November 1, 2007, 3:04pm UTC](https://www.ruby-forum.com/t/using-view-helpers-from-a-controller/118935/1 "2007-11-01T15:04:00Z")

</div>

Hi,

I want to access a view helper from a controller.

(Of course, you all want to know why??? – See below.)

To be specific, I want to access methods such as  
ActionView::Helpers::FormTagHelper – form\_tag and text\_field\_tag

from either a controller or from a new class (in models? or lib?).  
If I create the new class then that class’s methods need to also be able  
to access the ActiveRecord dbms classes. What class would the new class  
inherit from? Mix in from?

Why: I’m using the liquid template system to enable people to safely  
template their versions of my application. So I need to pass the various  
form tags of the screen to the liquid template. Thus I will not be using  
ActiveView rhtml etc to render. I could make a zillion calls (one for  
each element of the form) to render\_to\_string but that would not be  
efficient or workable. (A zillion partials.)

Thank you for your helpful comments.

Regards,

Larry
