Displaying 1 result from an estimated 1 matches for "right_owners".
2009 Oct 05
0
ActiveRecord Polymorphic Inheritance
...s the base class'' association methods in the
invocation of either to_xml or to_json without having to depict the
base class data in the serialized string. Here are my classes:
# base class
class Asset < ActiveRecord::Base
belongs_to :resource, :polymorphic => true
has_many :right_owners, :dependent => :destroy
end
# derived class
class Song < ActiveRecord::Base
has_one :asset, :as => :resource, :dependent => :destroy
end
# derived class
class Film < ActiveRecord::Base
has_one :asset, :as => :resource, :dependent => :destroy
end
If I instantiate...