Sorry Jeremy, it was my issue. I had a check for empty strings...  

"foo\n\nbar"=~ /^\s*$/

 🤦

I just used #presence, works much better
On Sunday, September 20, 2020 at 8:07:39 PM UTC+3 Jeremy Evans wrote:

> 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/7fc0bff6-470d-493f-9fbf-9a8251928c2cn%40googlegroups.com.

Reply via email to