On Sunday, September 20, 2020 at 12:36:15 AM UTC-7 [email protected] wrote:
> Here is a test I set up:
>
> test "line breaks allowed for about_me" do
> puts create(:user, about_me: "foo\n\nbar").about_me.inspect
> puts create(:user, about_me: "foo\nbar").about_me.inspect
> end
>
> The output is:
>
> >> nil
> >> "foo\nbar"
>
> So one line break is ok, but you put two and literally enters null into
> the database.
>
> Has anyone seen this before? I'm using Postgres' TEXT field. I'm doing no
> other escaping except what Sequel is doing under the hood.
>
This isn't a general issue in Sequel:
DB.get("foo\n\nbar")
# SELECT 'foo
#
# bar' AS "v" LIMIT 1
# => "foo\n\nbar"
DB.get("foo\nbar")
# SELECT 'foo
# bar' AS "v" LIMIT 1
# => "foo\nbar"
Can you put together a self contained reproducible example showing that
Sequel is converting the string with two line breaks to nil?
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/0f995e03-660a-43d8-9575-67366eab77a8n%40googlegroups.com.