mercredi 18 mai 2016

uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Adapter::NATIVE_DATABASE_TYPES (NameError)

Im having a problem with running my rails server. ive set the abstract_mysql2_adapters at initializer that consist of:

class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
end

and it solved my rake db:migrate problem, but when i try to run my rails server it gives me this error.

C:/Users/XXXX/Documents/RoRCmS/simple_cms/config/initializers/abstract_mysql2_adapter.rb:2:in <class:Mysql2Adapter>': uninitialized constant ActiveRecord::ConnectionAda pters::Mysql2Adapter::NATIVE_DATABASE_TYPES (NameError) from C:/Users/John/Documents/RoRCmS/simple_cms/config/initializers/abstract_mysql2_adapter.rb:1:in' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/engine.rb:609:in block (2 levels) in <class:Engine>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/engine.rb:608:ineach' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/engine.rb:608:in block in <class:Engine>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:ininstance_exec' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in run' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:inblock in run_initializers' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:228:in block in tsort_each' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:431:in each_strongly_connected_component_from' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:349:inblock in each_strongly_connected_component' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:347:in each' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:347:incall' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:347:in each_strongly_connected_component' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:226:intsort_each' from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:205:in tsort_each' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:inrun_initializers' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/application.rb:215:in initialize!' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:inmethod_missing' from C:/Users/John/Documents/RoRCmS/simple_cms/config/environment.rb:5:in <top (required)>' from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:3:inrequire' from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:3:in block in <main>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:ininstance_eval' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in initialize' from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:innew' from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:in <main>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:ineval' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in new_from_string' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:40:inparse_file' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:277:in build_app_and_options_from_config' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:199:inapp' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in app' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:314:inwrapped_app' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in start' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands.rb:78:inblock in ' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in tap' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in' from bin/rails:4:in require' from bin/rails:4:in'

I really need to solve this problem now.. thanks guys.

Aucun commentaire:

Enregistrer un commentaire