Rails: acts_as_list (using acts_as_tree)

R

Rainer Jung

Hello there!

I have a small problem. I am building an gallery-application with
Rails.
The model for the gallery is using "acts_as_tree" and "has_many
:images".
The image model "belongs_to :gallery" and "acts_as_list :scope =>
:gallery_id".
I intended to use acts_as_list to be able to find all images in the
same gallery-scope to simply paginate the images with ":per_page => 1".
But now if i have the "@image", and try to get all other images, i
would try to do "@image.parent.children". With .parent i would get the
Gallery-instance, but if i use .children on that Gallery-instance, i
probably would get the other Gallery-instances, which are in the
subtree of the image.
Has someone a nice idea how to easily paginate the images from one
gallery?

Regards, Rainer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top