Permalink
Browse files

Moved database setup into initializer

  • Loading branch information...
1 parent 0f0e258 commit 867c24c25b4fa3137d632cb1f016d52022b47cac @lardawge lardawge committed Mar 14, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/rfm/utilities/factories.rb
@@ -9,7 +9,7 @@ class Factory < CaseInsensitiveHash
def initialize(server, database=nil)
@server = server
- @database = database
+ @database = database.nil? ? {} : { '-db' => database.name }
end
def [](name)
@@ -18,7 +18,7 @@ def [](name)
def all
set_options
- ResultSet.new(@server, @server.do_action(@server.options[:account_name], @server.options[:password], @url_options, @database.nil? ? {} : { '-db' => @database.name }).body).each do |record|
+ ResultSet.new(@server, @server.do_action(@server.options[:account_name], @server.options[:password], @url_options, @database).body).each do |record|
name = record[@hash_key]
self[name] = instantiate_klass(name) if self[name].nil?
end

0 comments on commit 867c24c

Please sign in to comment.