Skip to content

Instantly share code, notes, and snippets.

@djgraham
Created August 9, 2010 21:42
Show Gist options
  • Select an option

  • Save djgraham/516184 to your computer and use it in GitHub Desktop.

Select an option

Save djgraham/516184 to your computer and use it in GitHub Desktop.
class MyModel < 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
# Override the save method to prevent exceptions.
def save(validate = true)
validate ? valid? : true
end
attr_accessor :a, :b # etc...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment