I was curious if there was a built in feature in ActiveRecord or a plugin, but I basically have a database for phone numbers. I want a user to be able to make a phone number as main. There can only be one phone number marked as main at all times. Is there something for this? Thanks for your help.
on 2007-05-16 00:47
on 2007-05-16 01:37
I would use acts_as_list and add a method to return the phone at position 0 (or 1, depending on if acts_as_list is zero or one based). Maybe call the method main_phone. Now to make a phone number the "main" one just set it position to 1 using acts_as_list methods. On May 15, 4:47 pm, Ben J. <email@example.com>
on 2007-05-16 01:39
Oops. Sorry mixing my zero one based. I mean set it to position 0 of acts_as_list is zero based.
on 2007-05-16 01:40
vpim might help out... On May 15, 2007, at 2:37 PM, Robert W. wrote: >> I was curious if there was a built in feature in ActiveRecord or a > > > > Steve R. firstname.lastname@example.org http://www.calicowebdev.com
on 2007-05-16 01:42
A bit more specific: parent.children.move_to_top and it is zero based by the way.