# How to make an OSX Finder in rails/AJAX?

**URL:** <https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870>\
**Category:** Rails\
**Created:** [June 8, 2006, 10:15pm UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870 "2006-06-08T22:15:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 8, 2006, 10:15pm UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/1 "2006-06-08T22:15:52Z")

</div>

I need to make a category browser that would allow nested categories. Is  
there any receipe on that?

Currently, I use the :onchange event from one of the form element to  
update the first select (out of 4-5 selects), but I dont know how to  
elegantly reset all the child selects if I change the value from the  
first.

All the categories are fetched from the DB and I would like a ‘generic’  
solution to this. My current solution involves too much coupling between  
the Controller and the view and thats a Bad Thing ™.

Anyone can help with this?

---

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 8, 2006, 11:34pm UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/2 "2006-06-08T23:34:38Z")

</div>

Google for acts\_as\_tree and livetree.

I think the pair is what you’re looking for.

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 9, 2006, 4:53am UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/3 "2006-06-09T04:53:38Z")

</div>

Tom, you saved me days of troubles!!! Thanks a lot!

I was already using the act\_as\_tree but my googling never poped the  
livetree site.

You have no idea how happy I am! even tho I learned a lot trying to  
emulate that thing, I am happy to find something already tested and  
complete!

Ye!!!

---

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 9, 2006, 6:42am UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/4 "2006-06-09T06:42:37Z")

</div>

On Jun 8, 2006, at 8:01 PM, Mantat wrote:

> click on a value in the first column, it fetch the data from the DB  
> then  
> populate the second column. Then, when you pick a value from the  
> second  
> column, it will update the third.

Oh, THAT OS X Finder view!

There are 3 of them, after all. 🙂

Sorry for the misinformation.

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 9, 2006, 9:11am UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/5 "2006-06-09T09:11:37Z")

</div>

these people seem to do a convincing rendition of the finder’s column  
view  
=)  
[Apple - Support - Downloads](http://www.apple.com/downloads/dashboard/)

---

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 9, 2006, 5:01am UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/6 "2006-06-09T05:01:15Z")

</div>

Crap… .I feel stupid to reply to myself after my previous post but…

I talked too fast! I look at the specs, everything was fine until I  
looked at the screenshots.

The finder offered by livetree is more like the file explorer of  
windows. The Finder on the mac that I was talking about is the one that  
display each ‘level’ in a column. So let say we have 3 columns, when you  
click on a value in the first column, it fetch the data from the DB then  
populate the second column. Then, when you pick a value from the second  
column, it will update the third.

The problem is if at that time I click on the first column, it needs to  
clear the thrid column and update the second…

I have a solution in my head to do this but it involves a lot of  
javascript and too much coupling between the controller and the view…

So still looking…

---

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 9, 2006, 1:24pm UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/7 "2006-06-09T13:24:34Z")

</div>

unknown wrote:

> these people seem to do a convincing rendition of the finder’s column  
> view  
> =)  
> [Apple - Support - Downloads](http://www.apple.com/downloads/dashboard/)

Actually, they dont… the column no 3 doesnt clear when you change the  
selected item form colum 1…

This is really not as easy as I fight thought!!! I will keep you  
informed of my progress…

---

<div class="post-metadata">

**Author:** ![Mantat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@Mantat](https://www.ruby-forum.com/u/Mantat)\
**Post date:** [June 9, 2006, 1:34pm UTC](https://www.ruby-forum.com/t/how-to-make-an-osx-finder-in-rails-ajax/62870/8 "2006-06-09T13:34:06Z")

</div>

Ajax and partials should help you there.

[apple.com](http://apple.com) does this with this structure

Thus. It only updates col\_2 when something is selected in col\_1. However. You could organize this like so:

That way. When you do an ajax call to change col\_2 it automatically  
removes col\_3. You just have to include

 at the  
end of your col\_2 partial.

On 6/9/06, Mantat [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> informed of my progress…
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–
