:order question

I’m new to rails, so excuse me if this is a silly/simple question - It
appears that rails is doing the annoying way of ordering items, with
10 - 19 following 1, 20-29 following 2, etcetera.

Does anyone know of a way to make it logically order id’s?

Brien wrote:

I’m new to rails, so excuse me if this is a silly/simple question - It
appears that rails is doing the annoying way of ordering items, with
10 - 19 following 1, 20-29 following 2, etcetera.

Does anyone know of a way to make it logically order id’s?

The most likely reason for this is that you made the id column a string
in the database rather that making it an INT.
If this is not the case or you don’t understand please post the
migration/sql you used to create the table your selecting from. So we
can help further.

Keynan

class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
end
end

def self.down
drop_table :posts
end
end

I’ve been using CocoaMySQL for managing the tables directly, as well.

I’m trying to call posts.id with classic pagination, namely

@post_pages, @posts = paginate :posts, :order => 'id', :per_page

=> 10

On Aug 16, 3:58 pm, Keynan P. [email protected]