Created
March 1, 2018 08:50
-
-
Save StevenJL/bb17b34a38c38a84295e1e3eb3ecf888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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