Skip to content

Instantly share code, notes, and snippets.

@williscool
Last active December 16, 2015 20:29
Show Gist options
  • Save williscool/5492679 to your computer and use it in GitHub Desktop.
Save williscool/5492679 to your computer and use it in GitHub Desktop.
Using a rails helper in a mailer or other class
class SomeMailer
class Helper
include ActionView::Helpers # rails standard helpers
include HelpfulMethodsHelper # for some function i_wrote
end
def helper
@@h ||= Helper.new
end
def email_with_stuff
# then you can use it like
helper.strip_tags()
#or
helper.function_i_wrote
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment