I have some models which use the same table via single table
inheritance. I (think I) need to change objects from one class to
another and not sure how to go about that.
Consider these models:
class Project < ActiveRecord::Base
class Goal < Project # inherits project characteristics
class Assignment < Project # inherits project characteristics
They are distinguished from each other by the ‘type’ column.
class CreateProjects < ActiveRecord::Migration
create_table :projects do |t|
t.column :type, :string
How would I convert a ‘Project’ object into a ‘Goal’ object while
preserving other characteristics (id, title, etc.)?