strip_links(html) in a rake task


I would like to use the helper strip_links(html) in one of my rake task.

Is there anyway I can do that ? I've tried to look for solutions on
Google with no success.

Thank you very much,


Write this code in some file in lib folder:

def helper

class Helper
  include Singleton
  include ActionView::Helpers::TextHelper

then you can access your helper method in models and controllers (that
way you could use it in rake tasks too i believe) using

I don't know if its work in a rake task, but since rails 2.1, there is
another way to to this :


Hope it will help

@Gabriel : Thanks so much! ApplicationController.helpers.strip_links
worked fine in rake.

@Andrius : thanks for your answer (I haven't tried it, since Gabriel's
is more simple).

Have a nice day!

Gabriel Laskar wrote: