undefined方法has_key? for false:FalseClass(NoMethodError)

时间:2011-07-06 13:22:50

标签: ruby-on-rails sharding

我正在尝试使用Octopus gem进行数据库分片。我跟着this wiki。

  

如果您需要使用动态分片   保存的分片配置   数据库,您可以创建初始化程序   包含这个例子的东西:

begin
  shards = {:my_shards => {}}
  Shard.all.each do |shard|
    shards[:my_shards][shard.database] = {:host => shard.host, :adapter => shard.adapter, :database => shard.database, :username => shard.username, :password => shard.password, :encoding => shard.encoding }
  end

 Octopus.setup do |config|
    config.shards = shards
    config.environments = [:development, :testing, :production, :staging]
  end

rescue ActiveRecord::StatementInvalid => e
  puts e
end

当我尝试启动应用程序时,我收到此错误。我正在使用rails 3.0.9

C:/Ruby192/lib/ruby/gems/1.9.1/gems/ar-octopus-0.3.4/lib/octopus/proxy.rb:16:in `initialize_shards': undefined method `has_key?' f or false:FalseClass (NoMethodError)

任何帮助将不胜感激。

0 个答案:

没有答案