I am going along with this document

https://github.com/jeremyevans/sequel/blob/master/doc/querying.rdoc

So I want to do the following

field_names = [....]

Model.select(field_names).all

or Model.select(field_names).where(blah).all

or something like that. If I make the field names strings I get a set of
records that looks like this.

select(field_names).to_a
I, [2017-10-14T14:39:00.910497 #46087]  INFO -- : (0.000670s) SELECT ('id',
'last_picture_url', 'last_picture_thumbnail_url', 'active', 'latitude',
'longitude') FROM "honesty_boxes"
=> [#<HonestyBox
@values={:row=>"(id,last_picture_url,last_picture_thumbnail_url,active,latitude,longitude)"}>,
 #<HonestyBox
@values={:row=>"(id,last_picture_url,last_picture_thumbnail_url,active,latitude,longitude)"}>,
 #<HonestyBox
@values={:row=>"(id,last_picture_url,last_picture_thumbnail_url,active,latitude,longitude)"}>,
 #<HonestyBox
@values={:row=>"(id,last_picture_url,last_picture_thumbnail_url,active,latitude,longitude)"}>,
 #<HonestyBox
@values={:row=>"(id,last_picture_url,last_picture_thumbnail_url,active,latitude,longitude)"}>,
 #<HonestyBox
@values={:row=>"(id,last_picture_url,last_picture_thumbnail_url,active,latitude,longitude)"}>]

So each row returns a string which is the list of names. That seems odd so
I tried it with symbols

and I get this

SELECT ("id", "last_picture_url", "last_picture_thumbnail_url", "active",
"latitude", "longitude") FROM "honesty_boxes"
=> [#<HonestyBox @values={:row=>"(58,,,,-37.7369365,175.9807413)"}>,
 #<HonestyBox @values={:row=>"(59,,,,-37.7069365,175.8807413)"}>,
 #<HonestyBox @values={:row=>"(60,,,,-38.7069365,177.8807413)"}>,
 #<HonestyBox @values={:row=>"(61,,,,-37.7369365,175.9807413)"}>,
 #<HonestyBox @values={:row=>"(62,,,,-37.7069365,175.8807413)"}>,
 #<HonestyBox @values={:row=>"(63,,,,-38.7069365,177.8807413)"}>]

In this case I get the values in the string.

Not quite sure what the problem is here. This ought to be pretty
straightforward and the SQL log shows it's running the right queries but
all I get are strings with either field names or values in them.

What am I missing here?

-- 
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