Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Created March 1, 2018 08:50
Show Gist options
  • Save StevenJL/bb17b34a38c38a84295e1e3eb3ecf888 to your computer and use it in GitHub Desktop.
Save StevenJL/bb17b34a38c38a84295e1e3eb3ecf888 to your computer and use it in GitHub Desktop.
class Animal < ActiveRecord::Base
def eat
end
end
class Bird < Animal
set_table_name "birds"
def fly
end
end
class Mammal < Animal
set_table_name "mammals"
def run
end
end
class Fish < Animal
set_table_name "fish"
def swim
end
end
class CreateMammal < ActiveRecord::Migration
def change
create_table :mammals do |t|
t.integer :num_of_legs
# ... more column fields #
t.timestamps
end
end
end
class CreateFish < ActiveRecord::Migration
def change
create_table :fish do |t|
t.integer :num_of_fins
# ... more column fields #
t.timestamps
end
end
end
class CreateBird < ActiveRecord::Migration
def change
create_table :birds do |t|
t.float :wing_span
# ... more column fields #
t.timestamps
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment