# STI: is it possible to map STI resource?

**URL:** <https://www.ruby-forum.com/t/sti-is-it-possible-to-map-sti-resource/144315>\
**Category:** Rails\
**Created:** [July 28, 2008, 4:28pm UTC](https://www.ruby-forum.com/t/sti-is-it-possible-to-map-sti-resource/144315 "2008-07-28T16:28:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianluca\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/d78d45/32.png) [@gianluca\_t](https://www.ruby-forum.com/u/gianluca_t)\
**Post date:** [July 28, 2008, 4:28pm UTC](https://www.ruby-forum.com/t/sti-is-it-possible-to-map-sti-resource/144315/1 "2008-07-28T16:28:30Z")

</div>

Hi to all,

someone can tell me if are there some ways to map STI model into a  
resource map ? (restful)

I cannot figure out how to implement a single controller/views to handle  
STI resources…

Ex.:

Model : Category =\> type(s) =\> CategoryEvent, CategoryCalendar, and so  
on…

I want to have a single restful controller ex. categories handling all  
category types in some ways:

ex.

List all category of type Calendar: /categories/CategoryCalendar  
New category of type Event: /categories/new/CategoryEvent

I cannot figure out how to map map.resource…, maybe passing a type  
parameter? but doing so it’s not beautiful:

/categories?type=CategoryCalendar  
/categories/new?type=CategoryEvent

Someone can help me ?

Thanks a lot…
