Skip to content

Inserting a new inherited class in the middle #58

@justinchoy

Description

@justinchoy

What is the exact procedure of writing the migration for inserting a class in the middle of the inheritance structure? Quick Example that follows from the Usage Guide

class BoundedBook < Book
acts_as_citier
end

class Dictionary < BoundedBook
acts_as_citier
end

class CreateBoundedBooks < ActiveRecord::Migration
def self.up
create_table :bounded_books do |t|
t.string :binder
end
drop_citier_view(Dictionary)
create_citier_view(BoundedBook)
create_citier_view(Dictionary)

/**  
 *  SOME CODE TO POPULATE THE bounded_book TABLE
 *  WITH THE :binder DATA FOR EXISTING DICTIONARIES
 **/

end
def self.down
drop_citier_view(BoundedBook)
drop_table :bounded_books
end
end

Whats the code I need to insert? Something like Dictionary.find_each do etc etc etc. Then create new BoundedBook objects? Please help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions