Last active
December 16, 2015 20:29
-
-
Save williscool/5492679 to your computer and use it in GitHub Desktop.
Using a rails helper in a mailer or other class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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