On Mon, Nov 2, 2020 at 9:17 AM Narayan Pallipamu <[email protected]>
wrote:

> Hi I am running into this issue while using factory_bot to instantiate
> some classes of type Sequel::Module for a test. I'm using rails and
> minitest. It is a Postgresql db and the table/module i am having an issue
> instantiating (inserting) is has a column "uuid" that has a type of bytea.
> I am try to assign it to a string representation of a uuid and it seems to
> get wrapped in a Sequel::SQL::Blob so not sure what I need to do to fix
> this:
>
>  Sequel::Error: can't express #<Conversation @values={:id=>1,
> :uuid=>#<Sequel::SQL::Blob:0x2ac44dfd1074 bytes=36 start="089188fa-1"
> end="42ac120002">,  ... }> as a SQL literal
>
> I am certain it is that column because if I leave it out I get a pq sql
> error trying to insert the row without specifying the uuid (its set to not
> null)
>
> My factory looks like this:
>
> FactoryGirl.define do
>  to_create { |instance| instance.save }
>    factory :conversation do
>      id 1
>      uuid '089188fa-1a36-11eb-adc1-0242ac120002'
>    end
> end
>
>
> My class looks like this:
>
> class Conversation < Sequel::Model
>
> end
>

I'm not sure about factory_bot, but the Sequel issue is you are trying to
literalize a Conversation instance, and Sequel does not know how to do
that.  That is unrelated to the blob/bytea usage (that appears correct).
If you can reproduce your issue without using factory_bot , please post
here.  If you cannot, you may want to ask for assistance on a factory_bot
specific forum.

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/CADGZSSeiCaQCUXJmboVdF41fKE_rn4Z0-8MSSh0bufmNkDh0Ug%40mail.gmail.com.

Reply via email to