rails s:未定义的方法`symbolize_keys'

Jér*_*yet 3 ruby ruby-on-rails ruby-on-rails-3

我有一个rails 3.2.12应用程序,但当我跑rails s,我得到以下错误:connection_specification.rb:45:in 'resolve_hash_connection': undefined method 'symbolize_keys' for #<String:0x00000006c16b40> (NoMethodError)

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
Run Code Online (Sandbox Code Playgroud)

Agi*_*gis 11

#symbolize_keys是一种将Hash接收器作为接收器的方法,但是你在它上面调用它String.