Displaying 1 result from an estimated 1 matches for "external_link".
2006 Jun 23
1
instantiate record in single table inheritance
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