# Acts\_as\_list scope and polymorphic association

**URL:** <https://www.ruby-forum.com/t/acts-as-list-scope-and-polymorphic-association/61214>\
**Category:** Rails\
**Created:** [May 21, 2006, 11:39pm UTC](https://www.ruby-forum.com/t/acts-as-list-scope-and-polymorphic-association/61214 "2006-05-21T23:39:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![olivier\_Hericord](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c68b51/32.png) [@olivier\_Hericord](https://www.ruby-forum.com/u/olivier_Hericord)\
**Post date:** [May 21, 2006, 11:39pm UTC](https://www.ruby-forum.com/t/acts-as-list-scope-and-polymorphic-association/61214/1 "2006-05-21T23:39:11Z")

</div>

this is my model:

class Person \< ActiveRecord::Base  
has\_many :phones, :as =\> :callable, :order =\> :position  
end

class Phone \< ActiveRecord::Base  
belongs\_to :callable, :polymorphic =\> true  
acts\_as\_list :scope =\> :callable\_id  
end

how can i add the callable\_type to the scope.  
how can i say the scope is the {:callable\_id,:callable\_type} couple?

is it even possible?

thanks

---

<div class="post-metadata">

**Author:** ![olivier\_Hericord](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c68b51/32.png) [@olivier\_Hericord](https://www.ruby-forum.com/u/olivier_Hericord)\
**Post date:** [May 21, 2006, 11:48pm UTC](https://www.ruby-forum.com/t/acts-as-list-scope-and-polymorphic-association/61214/2 "2006-05-21T23:48:20Z")

</div>

in fact i should have something like

:scope =\> ‘callable\_id = #{parent\_object\_id} and callable\_type =  
#{parent\_object\_type}’

how can i write in ruby parent\_object\_id and parent\_object\_type?

this.parent.type ? this.parent.id? 🙂

can’t get something that work

help

---

<div class="post-metadata">

**Author:** ![olivier\_Hericord](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c68b51/32.png) [@olivier\_Hericord](https://www.ruby-forum.com/u/olivier_Hericord)\
**Post date:** [May 21, 2006, 11:51pm UTC](https://www.ruby-forum.com/t/acts-as-list-scope-and-polymorphic-association/61214/3 "2006-05-21T23:51:28Z")

</div>

finally solved it on my own just after starting this thread 🙂

‘callable\_id=#{callable\_id} and callable\_type=#{quote callable\_type}’

---

<div class="post-metadata">

**Author:** ![olivier\_Hericord](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c68b51/32.png) [@olivier\_Hericord](https://www.ruby-forum.com/u/olivier_Hericord)\
**Post date:** [May 21, 2006, 11:57pm UTC](https://www.ruby-forum.com/t/acts-as-list-scope-and-polymorphic-association/61214/4 "2006-05-21T23:57:33Z")

</div>

on my own with Rails Weenie help 🙂
