Forum: Ruby on Rails Using the ActionView::Helpers::FormTagHelper and ActionView:

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
05eb1fd50435a1a6092491d528ffc740?d=identicon&s=25 Mario Jauvin (Guest)
on 2007-05-03 04:53
(Received via mailing list)

I have a utility class (in the lib/media_set/media.rb file in my ruby
application) and in there, I would like to access the
ActionView::Helpers::FormTagHelper.select_tag and
ActionView::Helpers::FormOptionsHelper.options_for_select to create a
select tag.  However, in the view files, I can just refer to
select_tag(...) or options_for_select(...) and obviously rails "know"
that these are instance methods on some instance of the FormTagHelp
and FormOptionsHelper classes.  I have two questions:

1. how can I use the select_tag and options_for_select methods in my
utility class?  Can I use the same instance as would have been used in
the view?
2. how does Rails make accessible or associate select_tag and
options_for_select with an existing instance of these classes in the
view file?

Much appreciated.
This topic is locked and can not be replied to.