Created
January 12, 2015 15:43
-
-
Save nwjsmith/6fe5333a21694c1b79ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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