Skip to content

Commit

Permalink
Fixed ActiveRecord connection when racked in an application with it's…
Browse files Browse the repository at this point in the history
… own ActiveRecord connection
  • Loading branch information
dvantuyl authored and zuk committed Jun 28, 2011
1 parent 9eee1b4 commit 8176cc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
source "http://rubygems.org"
gemspec

7 changes: 4 additions & 3 deletions lib/casserver/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,9 @@ def self.init_logger!
end

def self.init_database!
#CASServer::Model::Base.establish_connection(config[:database])
ActiveRecord::Base.establish_connection(config[:database])


unless config[:disable_auto_migrations]
ActiveRecord::Base.establish_connection(config[:database])
print_cli_message "Running migrations to make sure your database schema is up to date..."
prev_db_log = ActiveRecord::Base.logger
ActiveRecord::Base.logger = Logger.new(STDOUT)
Expand All @@ -264,6 +263,8 @@ def self.init_database!
ActiveRecord::Base.logger = prev_db_log
print_cli_message "Your database is now up to date."
end

CASServer::Model::Base.establish_connection(config[:database])
end

configure do
Expand Down

0 comments on commit 8176cc6

Please sign in to comment.