You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Event.select(:time).limit(2).map{|s| s}
I, [2008-02-09T03:28:30.453212 #3652] INFO -- : SELECT time FROM events ORDER BY id
LIMIT 2
=> [#<Event:0xb732f8cc @primary_key=:id, @changed_columns=[], @new=false, @values={:time=>Fri Jan 18 19:41:18 +0000 2008}>, #<Event:0xb732f4bc @primary_key=:id,
@changed_columns=[], @new=false, @values={:time=>Fri Jan 18 19:41:21 +0000 2008}>]
That works just fine. But if I try to use one of the fields inside my map block:
Event.select(:time).limit(2).map{|s| s.time}
I, [2008-02-09T03:29:36.677697 #3652] INFO -- : SELECT time FROM events ORDER BY id
LIMIT 2
I, [2008-02-09T03:29:36.678618 #3652] INFO -- : SELECT * FROM events ORDER BY id LIMIT
1
Mysql::Error: Commands out of sync; you can't run this command now
from /usr/local/lib/ruby/gems/1.8/gems/sequel_core-
1.0.5/lib/sequel_core/adapters/mysql.rb:132:in query' from /usr/local/lib/ruby/gems/1.8/gems/sequel_core- 1.0.5/lib/sequel_core/adapters/mysql.rb:132:inexecute_select'
Using a plain dataset, or the hash syntax with models has no issues:
Event.select(:time).limit(2).map{|s| s[:time]}
I, [2008-02-09T03:31:41.327187 #3652] INFO -- : SELECT time FROM events ORDER BY id
LIMIT 2
=> [Fri Jan 18 19:41:18 +0000 2008, Fri Jan 18 19:41:21 +0000 2008]
Sounds like method_missing in the model calls .columns, which tries issuing the new query and
fails? Maybe can just check @values.keys instead?
Google Code Info:
Issue #: 150
Author: themaste...@gmail.com
Created On: 2008-02-09T03:34:34.000Z
Closed On: 2008-02-09T22:12:14.000Z
The text was updated successfully, but these errors were encountered:
That works just fine. But if I try to use one of the fields inside my map block:
Using a plain dataset, or the hash syntax with models has no issues:
Sounds like method_missing in the model calls .columns, which tries issuing the new query and
fails? Maybe can just check @values.keys instead?
Google Code Info:
Issue #: 150
Author: themaste...@gmail.com
Created On: 2008-02-09T03:34:34.000Z
Closed On: 2008-02-09T22:12:14.000Z
The text was updated successfully, but these errors were encountered: