Where do I put helper methods for ActionMailer views?

前端 未结 6 1259
无人共我
无人共我 2020-12-09 16:41

I have a method that takes an array of strings and joins them so they do something like this:

>> my_arr
=> [\"A\", \"B\", \"C\"]
>> and_join(m         


        
6条回答
  •  伪装坚强ぢ
    2020-12-09 16:58

    +1, worked fine, just a little correction:

    You have to use module instead of class in the helper file:

    # mailer_helper.rb
    module MailerHelper
      def and_join(arr)
        # whatever …
      end
    end
    

提交回复
热议问题