Top Level Namespace

Defined Under Namespace

Modules: UseDb, UseDbPlugin Classes: UseDbTest

Instance Method Summary collapse

Instance Method Details

#create_test_model(model_name, prefix = "", suffix = "", rails_env = RAILS_ENV) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
# File 'lib/use_db/test_model.rb', line 1

def create_test_model(model_name, prefix="", suffix="", rails_env=RAILS_ENV)
	# puts "Creating test model '#{model_name}', :prefix => '#{prefix}', :suffix => '#{suffix}'"
	str = <<-EOF
	require "use_db"
	
		class #{model_name} < ActiveRecord::Base
			use_db :prefix => "#{prefix}", :suffix => "#{suffix}", :rails_env => "#{rails_env}"
		end
EOF
	eval(str)
end