Skip to content

Excess spaces while rendering multiline string #869

@atomAltera

Description

@atomAltera

Hello, today I end up with strange issue in Rails 5:

Here is how a simple text.html.erb file looks like:
<textarea><%= "a\nb\nc" %></textarea>
And here is what it produce:
enter image description here enter image description here

I'm talking about these leading spaces before second and third strings.

In my code I have a form with textarea:

.form
  =form_for article do |f|
    .form-group
      =field_label f, :text, true
      =f.text_area :text, class: %w(form-control), rows: 20, placeholder: t('placeholder.article_text')

And the same issue happens there on Edit action

I found out that the reason is haml-rails gem in Gemfile. Without it <textarea><%= "a\nb\nc" %></textarea> forks fine, but with it, it adds extra spaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions