I can't believe there isn't a standard way of doing this, but I'm submitting content from a textarea to a Rails controller, and it doesn't seem to preserve the line breaks (of any form).
Here is my view code:
f.text_area :keywords, :cols => 50, :rows => 10
submit_to_remote 'button', "#{t "add_keywords"}",
:html => {:id => 'add_keywords_button'},
:url => { :controller=> :keywords, :action => :add_to_site },
:escape => true,
:loading=>"Form.Element.disable('add_keyword_button')",
:complete=>"Form.Element.enable('add_keyword_button');",
:update => { :success => "keywords_table_decorator", :failure => "message"
After submitting this goes to a controller that just needs to be able to parse out each keyword, line by line. I've tried all of the variations on the following theme:
@keywords = params[:site_keywords][:keywords]
puts @keywords.gsub(/\n|\r|\r\n/,'*')
just to see if I can get something that I can do a further split with.
I'd appreciate advice on getting this to work.