I''m looking at the typo (blog software) source. The categeries table has a position field which holds the order that the categories should appear on the blog. The field appears automagically populated when creating a new record or deleting an existing record, i.e., when a new category is added, its position is set to 1+max(position), and when a category is deleted, all the positions are reordered to 1..numberofrecords. But I don''t see how or where this is done. In category.rb there''s a method to reorder the categories, but this is not called either on new or destroy. I put a position field in my own table, but it''s always nil. I''m stumped. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Feb 16, 2008, at 17:19 , rubynuby wrote:> I''m looking at the typo (blog software) source. The categeries table > has a position field which holds the order that the categories should > appear on the blog. The field appears automagically populated when > creating a new record or deleting an existing record, i.e., when a new > category is added, its position is set to 1+max(position), and when a > category is deleted, all the positions are reordered to > 1..numberofrecords. But I don''t see how or where this is done.acts_as_list ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
D''oh! Somehow I missed that. It''s only the first line in the model :) noob is as noob does! thanks On Feb 16, 8:25 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> acts_as_list ?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---