donut
1
Hi,
I’ve written a class sitting in a file in the Lib directory and this
class needs to use strip_tags from TextHelper. I’ve added
include ActionView::Helpers::TextHelper
to the class but Ruby complains that the method strip_tags doesn’t
exist. How can I access ActionView methods from a a class in Lib?
Thanks.
donut
2
Donut D. wrote:
I’ve written a class sitting in a file in the Lib directory and this
class needs to use strip_tags from TextHelper. I’ve added
include ActionView::Helpers::TextHelper
to the class but Ruby complains that the method strip_tags doesn’t
exist. How can I access ActionView methods from a a class in Lib?
Are you trying to call strip_tags from a class or instance context?
If you want to add the helpers as class methods, instead use
extend ActionView::Helpers::TextHelper
–
We develop, watch us RoR, in numbers too big to ignore.