Forum: Ruby on Rails acts_as_list scope and polymorphic association.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
olivier Hericord (Guest)
on 2006-05-22 01:39
(Received via mailing list)
this is my model:

class Person < ActiveRecord::Base
  has_many :phones, :as => :callable, :order => :position

class Phone < ActiveRecord::Base
  belongs_to :callable, :polymorphic => true
  acts_as_list :scope => :callable_id

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?

olivier Hericord (Guest)
on 2006-05-22 01:48
(Received via mailing list)
in fact i should have something like

:scope => 'callable_id = #{parent_object_id} and callable_type =

how can i write in ruby parent_object_id and parent_object_type?

this.parent.type ?   :)

can't get something that work

olivier Hericord (Guest)
on 2006-05-22 01:51
(Received via mailing list)
finally solved it on my own just after starting this thread   :)

'callable_id=#{callable_id} and callable_type=#{quote callable_type}'
olivier Hericord (Guest)
on 2006-05-22 01:57
(Received via mailing list)
on my own with Rails Weenie help :)
This topic is locked and can not be replied to.