Forum: Ruby on Rails Reuse code

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ovidiu EFTIMIE (Guest)
on 2006-05-12 00:09
(Received via mailing list)
Hi,
I have several helper methods that I use on one view . Is there a way
to share this methods on several views ?
To be more specific in: companies_helper I've defined the helper
methods that I would like to use in products section.

Thanx,
Ovidiu
Kerry B. (Guest)
on 2006-05-12 00:25
(Received via mailing list)
On 11 May 2006, at 9:06 pm, Ovidiu EFTIMIE wrote:

> Hi,
> I have several helper methods that I use on one view . Is there a way
> to share this methods on several views ?
> To be more specific in: companies_helper I've defined the helper
> methods that I would like to use in products section.

I think all you have to do is something like this in your products
controller, but I may be wrong:

class ProductsController < ActionController
     helper :companies
     ...

Either that, or if the methods are very generic, move them to
application_helper.

Kerry
Ovidiu EFTIMIE (Guest)
on 2006-05-12 00:35
(Received via mailing list)
Thanks Kerry . I'll try that
This topic is locked and can not be replied to.