Skip to content

Instantly share code, notes, and snippets.

@nogtini
Forked from StevenJL/mti_animals.rb
Created August 15, 2019 17:39
Show Gist options
  • Save nogtini/b19f76c52900ead5ed57d2f33e20b3bf to your computer and use it in GitHub Desktop.
Save nogtini/b19f76c52900ead5ed57d2f33e20b3bf 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