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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---