Skip to content

Instantly share code, notes, and snippets.

@nas
Created December 10, 2009 15:37
Show Gist options
  • Save nas/253397 to your computer and use it in GitHub Desktop.
Save nas/253397 to your computer and use it in GitHub Desktop.
non table ActiveRecord
class StateMachine::TestBaseMixin < ActiveRecord::Base
# Make this class active recordish without the table
# and add the attributes as 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 :column_name, :string, :null => false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment