I couldn't figure out how to implement associations when the type of the heir is unknown.
Example: I want to do something like:
class Post < ActiveRecord::Base
acts_as_predecessor
belongs_to :site
end
class BlogPost < ActiveRecord::Base
acts_as_heir_of :post
end
class ImagePost < ActiveRecord::Base
acts_as_heir_of :post
end
class Site < ActiveRecord::Base
has_many :posts #could be BlogPost or ImagePost
def create_some_posts
post1 = BlogPost.create
posts << post1
post2 = ImagePost.create
posts << post2
end
end
How should I fix this code? Please advise. Thanks!
Hi,
Thanks for the great gem.
I couldn't figure out how to implement associations when the type of the heir is unknown. Example: I want to do something like:
How should I fix this code? Please advise. Thanks!