On Wednesday, February 22, 2017 at 8:32:03 PM UTC+1, Jeremy Evans wrote:
>
> On Wednesday, February 22, 2017 at 11:18:07 AM UTC-8, Aaron Heesakkers 
> wrote:
>>
>> Hi,
>>
>> My Sequel migrations stopped working. I wrote them some time last year, 
>> and included JSON columns. I'm a bit confused as to what has changed. I'm 
>> unable to find anything related in the changelogs.
>>
>> This is one of those migrations:
>>
>>       create_table(:organisation) do
>>         primary_key     :id
>>         DateTime        :created_at, default: 'NOW()'
>>         DateTime        :updated_at
>>         String          :name, :null=>false
>>         String          :description
>>         JSON            :domains
>>       end
>>
>>
>> And if I recall correctly, all I needed for those columns to work in the 
>> migrations was:
>> Sequel.extensions :core_extensions
>>
>> Now, after coming back to the project I end up with this error:
>> /Users/aaronh/.rvm/gems/ruby-2.3.1/gems/json-1.8.6/lib/json/common.rb:223
>> :in `generate': only generation of JSON objects or arrays allowed 
>> (JSON::GeneratorError)
>>
>> apparently because the const JSON is not (no longer?) found within Sequel 
>> namespace. It now tries to use the top level `JSON` const/gem, which breaks 
>> of course.
>>
>> All I have to do to resolve this, is replace `JSON` with `Json` or 
>> `Jsonb` or `Jsonh`. So it's all good, but I was wondering if this group 
>> could shine some light on what has changed. (Could be something with my 
>> project-setup or RVM, I'm not sure, I'm looking for hints).
>>
>> Cheers, and thanks for a great lib.
>>
>
> This is because the json library defines the JSON method on all objects. 
>  You should probably use json instead of JSON, or "column :domains, :json".
>
> The breakage is probably not due to Sequel, but it could be due to the 
> json library being required when you are running migrations now, when it 
> wasn't required previously.
>
>
>
Indeed it was. Thanks for your response. 

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to