What causes ActiveRecord to escape newlines in a text column? Is there a way to disable this behavior? (Illustrated below):
>> TestModel
=> TestModelid: integer, value: text, created_at: datetime, updated_at: datetime
# Create model instance with newline in text column "value"
>> t = TestModel.create!(:value => "\n")
+----+-------+-------------------------+-------------------------+
| id | value | created_at | updated_at |
+----+-------+-------------------------+-------------------------+
| 3 | \n | 2010-07-21 06:32:47 UTC | 2010-07-21 06:32:47 UTC |
+----+-------+-------------------------+-------------------------+
1 row in set
>> t.value
=> "\\n" # Newline is escaped?
>> t.value = "\n" # Set value back to newline
=> "\n"
>> t.value
=> "\n" # Value is not escaped (before save)
>> t.changes
=> {"value"=>["\\n", "\n"]}
>> t.save!
=> true
>> t.reload
>> t.value
=> "\\n" # Value is escaped after a save?