# STI and acts\_as\_list: scope =\> type does not work?

**URL:** <https://www.ruby-forum.com/t/sti-and-acts-as-list-scope-type-does-not-work/79555>\
**Category:** Rails\
**Created:** [December 16, 2006, 12:20pm UTC](https://www.ruby-forum.com/t/sti-and-acts-as-list-scope-type-does-not-work/79555 "2006-12-16T12:20:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [December 16, 2006, 12:20pm UTC](https://www.ruby-forum.com/t/sti-and-acts-as-list-scope-type-does-not-work/79555/1 "2006-12-16T12:20:09Z")

</div>

Hi all

I have a model Product1 and Product2 which both have Product as parent  
class. I use single table inheritance to share their similar DB fields.

Now I wanted to add acts\_as\_list for them, and wanted to use :scope =\>  
:type so the position numbers are not shared between Product1 and  
Product2 but every Class has its own order.

Sadly when adding a new Product1 or Product2 I get the following error:

NameError in UnikateController#manage  
undefined local variable or method `type\_id’ for #Product1:0x25a5270

Why does Rails append an “\_id” suffix to type? Is it not possible to use  
“type” only?

Thanks. Josh

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [December 16, 2006, 12:23pm UTC](https://www.ruby-forum.com/t/sti-and-acts-as-list-scope-type-does-not-work/79555/2 "2006-12-16T12:23:14Z")

</div>

Well got it myself already.

Rails API:  
scope - restricts what is to be considered a list. Given a symbol, itâ€™ll  
attach “\_id” (if that hasnâ€™t been already) and use that as the foreign  
key restriction.

So I’m using a string now instead of a symbol, and it works. Quite  
strange behavior though, is this consistently used throughout Rails?  
“Symbols can be modified by Rails, strings are taken as-is”?
