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. On Aug 13, 2009, at 12:11 PM, mjijackson wrote:> 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?
Quoting mjijackson <mjijackson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > 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