Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

simple_format behaviour changed when used in Mailer view

#6513

New (3.0.5) simple_format method in ActionMailer::MailHelper hides the one in ActionView::Helpers::TextHelper and has different behaviour:

A text block containing newlines/blank lines is now formatted into a single line.

I think it might be simply a case of renaming the Mailer simple_format to something else?

Reported by Chris Powell · March 3rd, 2011 @ 08:38 PM

State: resolved
Milestone: 3.1
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. mat
    mat

    Yeah, this is pretty poor form... here's the commit: https://github.com/rails/rails/commit/4083e0ea2ae6f87929a32935122f2...

    Pretty much just need to rename the method.

    March 8th, 2011 @ 08:14 PM

  2. mat
  3. mat
    mat

    Or patch, if you prefer.

    March 8th, 2011 @ 08:53 PM

  4. José Valim
    José Valim
    • State changed from new to resolved
    • Milestone set to 3.1
    • Assigned user set to José Valim
    • Importance changed from to Low

    Applied.

    March 8th, 2011 @ 09:50 PM

  5. Xavier Shay
    Xavier Shay

    Any reason this can't be in 3-0-stable? There is an additional regression in that this method now raises on nil, whereas it used to return a blank string.

    March 9th, 2011 @ 10:40 PM

  6. Xavier Shay
    Xavier Shay

    Further, since this is only a private refactoring, there is no public or even semi-public interface to worry about breaking.

    March 9th, 2011 @ 10:44 PM

  7. visnu
    visnu

    +1 on bringing it into 3-0-stable. I'm sitting at 3.0.4 due to this bug in 3.0.5 (and having used simple_format in mailer templates).

    March 9th, 2011 @ 10:52 PM

  8. Jason T Johnson
    Jason T Johnson

    This is also breaking my mailer templates, since the original method expects the second argument to be a hash and the one in MailHelper expects a fixnum. (I started getting "comparison of Fixnum with Hash failed" exceptions.)

    March 10th, 2011 @ 07:44 PM

  9. Bayan Khalili
    Bayan Khalili

    +1 to bring this back to 3.0-stable. This is where the problem was introduced, and I don't see a good reason why it can't be backported.

    April 13th, 2011 @ 07:25 AM

  10. Ricardo Panaggio
  11. Ricardo Panaggio
    Ricardo Panaggio

    We'll maintain a patched fork for that until it's backported: https://github.com/umamao/rails

    We're using 3.0.7, so I only patched the respective branch. If you need any older branch, let me know.

    May 2nd, 2011 @ 04:35 PM

  12. Arthur Klepchukov
    Arthur Klepchukov

    Without downgrading back to 3.0.4, I'm doing the following in my ActionMailer views to have access to the original simple_format:
    ActionView::Base.new.simple_format

    If there's a better or easier way, please share :)

    May 8th, 2011 @ 11:31 PM