Hi,

I am having issues with to_hash_groups, specifically when invoking it by 
providing an array of column names for the key_column and nothing for the 
value column.

As per the documentation 
<http://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html#method-i-to_hash_groups>
:

DB[:table].to_hash_groups([:first, :middle])

My example:

DROP TABLE IF EXISTS "people";

CREATE TABLE "people" (
  id SERIAL PRIMARY KEY,
  first_name varchar(255) default NULL,
  last_name varchar(255) default NULL,
  state varchar(50) default NULL,
  country varchar(100) default NULL
);

INSERT INTO 
  "people" (first_name,last_name,state,country)
VALUES
  ('Kasimir','Simmons','WI','United States'),
  ('Vivien','Avila','LA','United States'),
  ('Brett','Marsh','FL','United States'),
  ('Florence','Blair','WA','Australia');

I am using Sequel::Model in a rails application

When invoking Person.to_hash_groups([:state, :country]), it raises the 
following error:

NoMethodError: undefined methodvalues_at' for #Person:0x007f94de3557a8`

using #naked on the recordset works around the problem as an interim 
solution:

Person.naked.to_hash_groups([:state, :country])

The conditional at lib/sequel/dataset/actions.rb#L732 
<https://github.com/jeremyevans/sequel/blob/9cc1ba7ecc682fe2c5af4c876356806f83ce0b02/lib/sequel/dataset/actions.rb#L732>
 that's 
not being called for this example might have something to do with the 
problem.

Any help would be appreciated.

Thanks,

Steve

-- 
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/d/optout.

Reply via email to