Skip to content

Instantly share code, notes, and snippets.

@andrewculver
Created April 20, 2012 00:59
Show Gist options
  • Select an option

  • Save andrewculver/2425103 to your computer and use it in GitHub Desktop.

Select an option

Save andrewculver/2425103 to your computer and use it in GitHub Desktop.
Temporary fix for the extra newline (
) Rails 3.2.3 + Haml are adding to the output of the text_area form helper.
module ActionView
module Helpers
module FormHelper
def text_area(object_name, method, options = {})
html = InstanceTag.new(object_name, method, self, options.delete(:object)).to_text_area_tag(options)
html.gsub(/>\
/, '>').html_safe
end
end
end
end
@gleuch
Copy link
Copy Markdown

gleuch commented Apr 20, 2012

Oh nice. Much nicer. Mine was a WTF-knee-jerk hack. :)

@sandiegoscott
Copy link
Copy Markdown

Where do you put this? In /lib/action_view.rb? Rails seems to find it there on my machine, but not on Heroku.

@sandiegoscott
Copy link
Copy Markdown

Never mind. /config/initializers/action_view.rb is the right place for it.

@norman
Copy link
Copy Markdown

norman commented Apr 24, 2012

FYI this will work fine for ugly mode, but in indented mode it will add spaces after the opening textarea tag.

@joe1chen
Copy link
Copy Markdown

I've opened an issue rails/rails#6236 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment