Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

(FIX) Error for array of integers for postgres #10340

wants to merge 1 commit into


None yet
9 participants

Slike9 commented Apr 25, 2013

Field description in schema: t.integer :field_name, :type => :array.
Error: "undefined method `gsub' for 1:Fixnum" in PostgreSQLColumn#quote_and_escape.

@Slike9 Slike9 (FIX) Error for array of integers for postgres
Field description in schema: `t.integer :field_name, :type => :array`. 
Error: "undefined method `gsub' for 1:Fixnum" in PostgreSQLColumn#quote_and_escape.

rafaelfranca commented Apr 25, 2013

We'll need a test to this


senny commented Jun 23, 2013

@Slike9 ping, what is the status of this PR? Can you add a test-case?

Slike9 commented Jun 24, 2013

test fails (PostgresqlArrayTest#test_multi_dimensional)

@Slike9 Slike9 closed this Jun 24, 2013

Getting this error on v4.0.0.beta1 too


arunagw commented Jun 26, 2013

@Numerico on 4.0.0 too?

Numerico commented Jul 1, 2013

that's right. (or you mean to test it against 4.0.0 instead of 4.0.0.beta1?)

i finally by-passed it having an array of strings instead of integers, but I suppose it should work for ints, shouldn't it?


hubertlepicki commented Jul 2, 2013

I can confirm this is a problem and the pull request fixes it, so I am unsure why this has been closed. Can someone @Slike9 or @rafaelfranca re-open the issue?

@arunagw arunagw reopened this Jul 2, 2013


neerajdotname commented Jul 2, 2013

@hubertlepicki can you describe what problem you ran into. The PR description says it fixes the issue with t.integer :field_name, :type => :array . However that already works in master. Thanks.


hubertlepicki commented Jul 2, 2013

Tell you what, I'll make a separate pull request as this is, indeed similar, but slight different issue than described at least in the description here.


saulius commented Jul 10, 2013

This issue stops me from upgrading one of the apps to Rails 4. Fix in #11245 seems to resolve the issue. Just wanted to give heads up.


sevenseacat commented Aug 18, 2013

Also run into this issue in Rails 4.0.0. On a side note, type: :array did not work for me, I had to use array: true to get AR to even recognize the field as an array.

Changing the field to be of type string instead of integer also resolved the problem.

@alno alno referenced this pull request in jruby/activerecord-jdbc-adapter Sep 17, 2013


Fix compound arrays #464


senny commented Feb 13, 2014

Closing this PR. We have #11245 with a working solution. @Slike9 thanks for your work 💛

@senny senny closed this Feb 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment