Last active
December 8, 2016 02:02
-
-
Save miligraf/490e57776b90c459397dc13bebbcfd1a 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 User < ActiveRecord::Base | |
def self.columns | |
@columns ||= []; | |
end | |
def self.column(name, sql_type = nil, default = nil, null = true) | |
columns << ActiveRecord::ConnectionAdapters::Column.new( | |
name.to_s, | |
default, | |
sql_type.to_s, | |
null | |
) | |
end | |
column :name, :text | |
column :country_id, :integer | |
belongs_to :country | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment