2013-09-01 29 views
3

我有一個Rails 3.2.12應用程序,但是當我跑rails s,我得到了以下錯誤:connection_specification.rb:45:in 'resolve_hash_connection': undefined method 'symbolize_keys' for #<String:0x00000006c16b40> (NoMethodError)軌S:未定義的方法`symbolize_keys'

的connection_specification.rb關注方法:

def resolve_hash_connection(spec) # :nodoc: 
    spec = spec.symbolize_keys # Line 45 

    raise(AdapterNotSpecified, "database configuration does not specify adapter") unless spec.key?(:adapter) 

    begin 
    require "active_record/connection_adapters/#{spec[:adapter]}_adapter" 
    rescue LoadError => e 
    raise LoadError, "Please install the #{spec[:adapter]} adapter: `gem install activerecord-#{spec[:adapter]}-adapter` (#{e.message})", e.backtrace 
    end 

    adapter_method = "#{spec[:adapter]}_connection" 

    ConnectionSpecification.new(spec, adapter_method) 
end 
+0

這個問題似乎是脫離主題,因爲它是關於文件中的錯字未顯示。 – Flexo

回答

10

#symbolize_keys是一種將Hash作爲接收者的方法,但您將其稱爲String

+0

我可以將此字符串轉換爲散列嗎? –

+1

問題解決了:我的database.yml中缺少空格 –