mardi 6 janvier 2015

SQLite3::SQLException: no such column error

I'm trying to sort a Users model by its "likecount" instance method:



@x = Users.all.order(:likecount)


but I keep getting this error:



ActiveRecord::StatementInvalid in UsersController#show
SQLite3::SQLException: no such column: users.likecount: SELECT "users".* FROM "users" ORDER BY "users"."likecount" ASC


What am I doing wrong?


Aucun commentaire:

Enregistrer un commentaire