Sha256: f1aa5da6bb2ee773475ed4741ffb20250ead65b25dbce44a0686db22b7dd9a02

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'rubygems'
require 'active_record'
gem 'sqlite3-ruby'

require File.dirname(__FILE__) + '/../rails/init'
  
ActiveRecord::Base.logger = Logger.new('/tmp/encoder.log')
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => '/tmp/encoder.sqlite')
ActiveRecord::Migration.verbose = false
ActiveRecord::Base.default_timezone = :utc if Time.zone.nil?

ActiveRecord::Schema.define do
  create_table :tasks, :force => true do |table|
    table.string :status
    table.string :priority
  end
end

class Task < ActiveRecord::Base
  include ::Encoder
  
	code :status do
	  Status::New      = "N"
	  Status::Pending  = "P"
	  Status::Finished = "F"
	  Status::OverDue  = "O"
	end
	
	code :priority do
	  Priority::High =  "H"
	  Priority::Low =   "L"
  end
	
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
encoder-0.0.1 test/database.rb