views:

24

answers:

1

In my rails app, a user can have multiple directories which have further files and subdirectories, just like Dropbox. The only difference is Dropbox has user files both on the cloud and the client PC as well, whereas I want to store the entire directory on the cloud. How should i do it??

+1  A: 

Assuming all data is server-side, and there is no file transfer of any sort, I'd use one of the acts_as_nested_set mixins for your ActiveRecord model. These are like acts_as_tree but are optimized for the "collapsible tree" use case such as a javascript tree control widget.

There's the original acts_as_nested_set, but since then better_nested_set and awesome_nested_set have appeared, each purporting to improve on their predecessor. See the documentation for specific differences.

Mark Thomas