Skip to content

Instantly share code, notes, and snippets.

@nwjsmith
Created January 12, 2015 15:43
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 nwjsmith/6fe5333a21694c1b79ce to your computer and use it in GitHub Desktop.
Save nwjsmith/6fe5333a21694c1b79ce to your computer and use it in GitHub Desktop.
require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Base.connection.instance_eval do
create_table(:starting_goalies) do |t|
t.string :status
end
end
class StartingGoalie < ActiveRecord::Base
enum status: {
expected: 'Expected',
confirmed: 'Confirmed',
undecided: 'Undecided'
}
end
starter = StartingGoalie.new(status: 'Expected')
p starter.expected?
starter.confirmed!
p starter[:status]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment