DataMapper returns a DataMapper collection, which mostly acts like an array, but is lazy. For some reason, count is working on my machine, but not on Heroku, with the same version of DataMapper.
I did end up replacing all the counts with lengths, since that's working on both ends, so as now, I'm just curious why it wasn't working On Jun 28, 5:27 pm, "Matthew A. Brown" <[email protected]> wrote: > I'm not sure about DataMapper, but ActiveRecord returns an Array > object when you call #all. Array doesn't have the #count method -- > you're looking for #length. > > Or, if you want to do an SQL count, I believe you just want Game.count > > Mat > > On Sat, Jun 26, 2010 at 20:42, jeff <[email protected]> wrote: > > I am trying to deploy my sinatra application to Heroku, but it does > > not like that I am counting records, like Game.all.count, where Game > > is a DataMapper class. > > > I am using .gems to get a newer version than Heroku is providing, with > > this: > > > do_postgres --version 0.10.1 > > dm-validations --version 0.10.2 > > dm-timestamps --version 0.10.2 > > dm-core --version 0.10.2 > > dm-types --version 0.10.2 > > sinatra --version 1.0 > > > These are the same versions that I have installed; but .count works on > > my computer, but not on Heroku. > > > When I access it from the console, it tells me this: > > >>> User.all.count > > NoMethodError: undefined method `count' for #<DataMapper::Collection: > > 0x2ab821bf2530> > > > Does anyone know what the problem could be? > > > Thanks > > > -- > > You received this message because you are subscribed to the Google Groups > > "Heroku" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/heroku?hl=en. -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
