Get updates

Model

Scott Q&A: What Methods are Available with acts_as_list?

When you make use of Active Record’s convenient acts_as_list modifier in Rails, what does this do for you? Most of the info out there describes the way acts_as_list manages position of items, ordering them like items in a, well, ordered list.

That’s great, but what about new helper methods provided by acts_as_list? Doesn’t it make juggling list items easier? Or do you simply have to fend for yourself when you want to rearrange your list?

Question: What additional methods are provided when using acts_as_list?

Continue Reading…

Scott Displaying a hierarchy and acts_as_tree

What’s brewing over at ListFinity, home of infinite lists?

Well, supposedly right now I’m working out various means of constructing and manipulating “infinitely nestable” lists, as in an object hierarchy (aka tree view) of arbitrary depth.

That’s all well and good, but not as straightforward to code as the display of a single unordered list. I figured that such a hierarchy would be a good candidate for recursion, and in this case that didn’t sound like too big a chore to write… except when I started to imagine that each loop back to the recursive method would want to pass on the list data for the next loop to walk through another level, etc. This triggered a flash of nightmares where a sufficiently large or deep list (nevermind one mangled to include circular references) spurs the recursion on to eat memory like a mosquito with its proboscis stuck in the jugular.

Continue Reading…

3DM Design is where Scott Drake publishes thoughts on programming web applications in JavaScript and Ruby.