Acts_as_list problem

Hi all,
I’m having this confusing acts_as_list problem:

  • I have a Slideshow and Slide models, Slide acts as list in the scope
    of
    slideshow

  • the first record in the slides db table is <id : 1, position : 1
    ,…>
    and the second is <id : 2, position : 2 ,…>

  • when applying that code in the console the results were so strange,

    slideshow is a local variable a have defined.


slideshow.slides.first
#<Slide id: 1, position: 1, photo_id: 1, slideshow_id: 1>
slideshow.slides.first.move_lower
true
slideshow.slides.first
#<Slide id: 1, position: 2, photo_id: 1, slideshow_id: 1>
slideshow.slides[1]
#<Slide id: 2, position: 2, photo_id: 2, slideshow_id: 1>


does any one have any idea about what happened, and how to solve this
problem.

Thanks in advance,
yours,
Mostafa Badaw

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs