bradrobertson/apartment — Issue #16: [error message] Probably me
Author: charliemay
Created: 2012-01-17 12:04:19+00:00
State: open

In /config/initializers i created apartment.rb and put the following code in:

Apartment.configure do |config|
config.database_names = lambda{ Customer.select(:database_name).map(&:database_name) }
end

When I run rake apartment:migrate I get:
rake aborted!
uninitialized constant Customer

I tried replacing Customer with my project name 'Testapp', but then I get :
rake aborted!
private method `select' called for Testapp:Module

I have a medical app that was written in PHP about 5 years ago. It has grown out of control in size and complexity, so I'm going to rewrite it in rails (I almost made the jump 3 years ago). I'm new to rails, so sorry if this is the wrong place to ask for help on this gem as I am sure I am doing something wrong here and it is probably a simple fix. I have been on google for days, and even posted this question in a rails forum, but no luck. Any help getting this gem to work will be really appreciated. BTW, if I instead use config.database_names = ['db1', 'db2'] migrations work perfectly.