Self.id returning an array in 2.3?

I’m upgrading from 2.1 to 2.3 and having a small problem with my
models. It appears that when I use self.id now (say, from inside an
instance method) I’m getting an array back instead of a string. For
example, where under 2.1 I would get a “7” I’m now getting a [“7”].
Why the changed behavior?

Ugh, nevermind. Figured out what I was doing wrong.

Quoting mjijackson [email protected]:

I’m upgrading from 2.1 to 2.3 and having a small problem with my
models. It appears that when I use self.id now (say, from inside an
instance method) I’m getting an array back instead of a string. For
example, where under 2.1 I would get a “7” I’m now getting a [“7”].
Why the changed behavior?

My experience is that using the .id method is unreliable. Sometimes it
is
interpreted as the object ID which is deprecated instead of the id
column of
the database row. self[:id] always works as expected, in my experience.

HTH,
Jeffrey

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs