Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7e8dd76

Browse files
authored
Merge pull request #48 from adwyze/fix-enum-parsing
FIX #40: Handle enum attributes while instantiating rows
2 parents 43e7f36 + c6080e1 commit 7e8dd76

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

‎lib/postgresql_cursor/cursor.rb‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ def each_array(&block)
110110
def each_instance(klass=nil, &block)
111111
klass ||= @type
112112
self.each_tuple do |row|
113-
if ::ActiveRecord::VERSION::MAJOR < 4
114-
model = klass.send(:instantiate,row)
115-
else
116-
@column_types ||= column_types
117-
model = klass.send(:instantiate, row, @column_types)
118-
end
113+
klass.send(:instantiate, row)
119114
block.call(model)
120115
end
121116
end
@@ -144,12 +139,7 @@ def each_instance_batch(klass=nil, &block)
144139
klass ||= @type
145140
self.each_batch do |batch|
146141
models = batch.map do |row|
147-
if ::ActiveRecord::VERSION::MAJOR < 4
148-
model = klass.send(:instantiate, row)
149-
else
150-
@column_types ||= column_types
151-
model = klass.send(:instantiate, row, @column_types)
152-
end
142+
klass.send(:instantiate, row)
153143
end
154144
block.call(models)
155145
end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /