SET @prev=-1;
SET @rank=1;
SELECT @rank:=@rank+if(@prev > points,1,0) AS rank, user, @prev:=points
FROM users
ORDER BY points DESC;
create_table "posts", :force => true do |t|
t.string "title"
t.boolean "published"
t.integer "content_id"
t.string "content_type"
t.datetime "created_at"
t.datetime "updated_at"
end