Skip to content

Instantly share code, notes, and snippets.

@kastner
Created June 12, 2014 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kastner/32454a051cc427597174 to your computer and use it in GitHub Desktop.
Save kastner/32454a051cc427597174 to your computer and use it in GitHub Desktop.
enum!
#!/usr/bin/env ruby
require 'active_record'
class Thing < ActiveRecord::Base
belongs_to :group
enum number: [:a, :b]
end
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => ":memory:"
)
ActiveRecord::Schema.define do
create_table :things do |t|
t.integer :number
end
end
puts Thing.a.inspect
gem 'activerecord', '4.0'
gem 'sqlite3'
gem 'activerecord', '4.1'
gem 'sqlite3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment