On Tuesday, September 3, 2013 5:41:26 PM UTC-7, David Lutterkort wrote: > Hi all, > > I hope this is the right place to ask this kind of question; I am having > trouble using a PGArray in one of my models. > > The table backing the model looks like this: > > create_table :nodes do > primary_key :id > column :hw_info, 'Text[]', :null => false > ... other stuff ... > end > > My model class (which is just 'class Node < Sequel::Model; end') behaves > strange: > > # This works fine > n = Node.create(:hw_info => ["serial=1"]) > > # Here's the trouble; blows up with > # 'Sequel::ValidationFailed: hw_info is not a valid > sequel::postgres::pgarray' > n.save > > What am I doing wrong ? I am loading the relevant extensions on my DB: > > Sequel.extension :core_extensions, :inflector > Sequel.extension :pg_array, :pg_array_ops >
This should be: Sequel.extension :core_extensions, :inflector DB.extension :pg_array Sequel.extension :pg_array_ops You have to load the extension into your Database instance so that it has the necessary type conversion methods. 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
