Hi,
is there a way to instantiate a concrete subtype from within an
ActiveRecord collection?
Example:
class Link < ActiveRecord::Base
end
class InternalLink < Link
end
class ExternalLink < Link
end
internal_link = my_navigation.links.create_[xxxxxxx]
external_link = my_navigation.links.create_[xxxxxxxx]
the [xxx] is what I am missing…
I could do this
external_link = my_navigation.links.create(:type => ExternalLink.to_s)
but in this case the validations of ExternalLink will no be processed,
only of Link…
please help argh
cheers
peter