Sha256: c97c1e7fc946104b6362426192d0ea11d82ec2494b9679c1b0c96317db5452c7
Contents?: true
Size: 575 Bytes
Versions: 1
Compression:
Stored size: 575 Bytes
Contents
module WithModel autoload :Base, "with_model/base" autoload :Dsl, "with_model/dsl" autoload :VERSION, "with_model/version" def with_model(name, &block) dsl = Dsl.new(name, self) dsl.instance_eval(&block) if block dsl.execute end def with_table(name, options = {}, &block) before do connection = ActiveRecord::Base.connection connection.drop_table(name) if connection.table_exists?(name) connection.create_table(name, options, &block) end after do ActiveRecord::Base.connection.drop_table(name) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
with_model-0.3.2 | lib/with_model.rb |