Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User < ActiveRecord::Base
- class_attribute :columns
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement