Skip to content

Instantly share code, notes, and snippets.

@d3r1v3d
Created March 24, 2011 03:52
Show Gist options
  • Save d3r1v3d/884539 to your computer and use it in GitHub Desktop.
Save d3r1v3d/884539 to your computer and use it in GitHub Desktop.
module CustomColumnTypes
def double(*args)
args.last[:limit] = 53 if args.last.is_a? Hash
float *args
end
end
module ActiveRecord
module ConnectionAdapters
class Table
include CustomColumnTypes
end
class TableDefinition
include CustomColumnTypes
end
end
end
class CreateVeryPreciseTimes < ActiveRecord::Migration
def up
create_table :very_precise_times do |t|
t.datetime :measured_at
t.double :measured_at_frac
end
end
def down
drop_table :very_precise_times
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment