# RESTful dynamic select tags

**URL:** <https://www.ruby-forum.com/t/restful-dynamic-select-tags/119152>\
**Category:** Rails\
**Created:** [November 3, 2007, 9:28pm UTC](https://www.ruby-forum.com/t/restful-dynamic-select-tags/119152 "2007-11-03T21:28:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3da27b/32.png) [@Pascal\_F](https://www.ruby-forum.com/u/Pascal_F)\
**Post date:** [November 3, 2007, 9:28pm UTC](https://www.ruby-forum.com/t/restful-dynamic-select-tags/119152/1 "2007-11-03T21:28:49Z")

</div>

Hi there,

i have a RESTful (hope so… it’s my first one 🙂 ) app with a project  
model and a project controller.  
There is also a model timeblock which represents a specific amount of  
time a user spends working in a project for a specific task.  
I devide into projects and sub\_projects, these are the same project-  
model but sub projects have a project\_id other than 0 (i know the fact  
it’s called project\_id is a bit confusing…)

Timeblock is a nested resource of a user.  
To create a new timeblock i call the url /user/5/timeblocks/new and  
get a form with 2 selectboxes.

the first selectbox displays every project (project\_id == 0).  
i wan’t my app to dynamicly fill the second selectbox with the  
subprojects of the selected project.

workflow should look like this:  
user selects project with id 5 on selectbox1 =\> selectbox2 shows only  
the subprojects of the selected project (project\_id == 5)

i thought about a custom route like “/projects/5/  
show\_subproject\_optionlist” which returns the -tags for the  
subprojects so i can perform an ajax call onUpdate of selectbox1 on it  
and update selectbox2 but this doesn’t neither feel “Rails’ish” nor  
“Rest’ish” to me.

can you give ma some hints on how to solve my problem in a nice and  
clean way?

Thanks in advance,

Pascal
