Instantiating a Derived Class from an Instance of Base Class

I’ve got a ‘Task’ base class and a ‘ScheduledTask’ derived class that
I’m currently using with single table inheritance.

I’m trying to create a new ScheduledTask instance from an existing Task
instance:

scheduled_task = ScheduledTask.new(task)

but I get a NoMethodError: undefined method `stringify_keys!’ for
#Task:0x395d2a8.

I can get around this if I just instantiate a “blank” ScheduledTask
(.new) and manually fill in all of the shared attributes, but I know
there’s gotta be an easier way. Please advise.

Thanks!

bump

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs