Acts_as_list help

Thanks for the help all,

I have switched to using acts as list

process
has_many process_details, :order => :position, foreign_key
=> :process_id

process_detail
belongs_to process
acts_as_list :scope => :process_id

and I can view as a list. Thanks

Now I am working on, if data is entered into the and a position is
specified, I need to enter in this data into that particular position
and move the rest of the data down.

for example I have a list with 5 steps
1
2
3
4
5
and I insert a step with a position of 2 i want it to insert it into
two and move all the other ones down one(increment the position)
1
2 (new Record)
3(was 2)
4(was 3)
5(was 4)
6(was 5)
but what i get is
1
2
3
4
5
6 <= new record

I will be searching the forums but if the is an easy way to do this
please let me know.

All help is appreciated

White W.

On 10/4/07, White W. [email protected] wrote:

4
1
2
3
4
5
6 <= new record

I will be searching the forums but if the is an easy way to do this
please let me know.

How are you inserting it? If you are setting the position field
directly that won’t work, the list elements are always added to the
bottom via a before_create callback. I think you need to create it
and then call the insert_at method on the model object to move it.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/