Sha256: 9d61fea0f2780c096f89cc13cb7b611b273499d63a670dd3c42b62922f0495ea
Contents?: true
Size: 562 Bytes
Versions: 1
Compression:
Stored size: 562 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.new(name, self).tap { |dsl| dsl.instance_eval(&block) }.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.1 | lib/with_model.rb |