Re: :order question

Brien
Thu, 16 Aug 2007 23:29:01 -0000

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 Pratt
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> 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
> --
> Posted viahttp://www.ruby-forum.com/.