0

Not exactly sure how to go about this.

My app's database.yml

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: application-dev
  pool: 5
  username: root
  password: angles123
  socket: /tmp/mysql.sock

I was thinking that it would be wise to go ahead and mysqladmin -u root --password=angles123, and then once inside create database application-dev, but the -dev part, mysql is not happy about. But Icould create a database that said simply application.

Am I missing someting else possibly?

The reason I am bringing this up is because I get this error whenever I try to rake db:migrate, or script/server

rake db:test:prepare
(in /Users/macuser/Sites/hq_channel)
rake aborted!
uninitialized constant Geocode

So I assumed I set up the database wrong because I clearly have that gem installed.

Here is the full stacktrace :

rake aborted!
uninitialized constant Geocode
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing_not_from_s3_library'
/Users/macuser/Sites/hq_channel/vendor/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
/Users/macuser/Sites/hq_channel/config/initializers/geocode.rb:1
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:622:in `load_application_initializers'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:621:in `each'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:621:in `load_application_initializers'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:176:in `process'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/Users/macuser/Sites/hq_channel/config/environment.rb:21
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/railties/lib/tasks/misc.rake:4
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Trip
  • 26,756
  • 46
  • 158
  • 277
  • i bet geocode is missing a library – thenengah Oct 21 '10 at 03:09
  • @sam, I tried reinstalling geocode, but its not included in my config file. Geokit is though. And neither is actually used in my application, which makes me think is it possible to remove its dependencies on it? How would you go bout fixing a missing library? – Trip Oct 21 '10 at 11:29
  • specifically for for Geokit I don't know. But for some gems you need to give the path do the library. You do that by :lib => 'path/to/lib' – thenengah Oct 21 '10 at 16:20
  • such as config.gem 'geokit', :lib => 'path/to/geokit' – thenengah Oct 21 '10 at 16:21
  • @sam, what would the root of that path be? from application I have, `gems/geokit-1.4.1/lib/geokit` – Trip Oct 21 '10 at 20:11
  • @trip, I honestly don't know the full story but for two of my gems I need to include a lib. they are : `config.gem "ultraviolet", :lib => 'uv'`, and `config.gem "aws-s3", :lib => "aws/s3"` – thenengah Oct 21 '10 at 21:35
  • If you're not using it, remove `/config/initializers/geocode.rb` since it's initializing Geocode. – wesgarrison Oct 22 '10 at 03:10

1 Answers1

0

I've had mysql installations that didn't allow underscores or dashes in the database names.

You could try changing the database name to application and then running rake db:create to see if it creates your database.

Also, you can try running rake with --trace to get a better idea of what's being included from where that's causing that error.

wesgarrison
  • 6,975
  • 5
  • 30
  • 39
  • Hey I think you're right. I got this when I tried `rake db:create (in /Users/macuser/Sites/application) Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8", "username"=>"rootsies", "adapter"=>"mysql", "database"=>"application", "pool"=>5, "password"=>"angles1234", "socket"=>"/tmp/mysql.sock"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)` – Trip Oct 21 '10 at 10:53
  • I have also, set priveleges for root and my user for the database as well. What do you think I missing? – Trip Oct 21 '10 at 10:58
  • Sounds like a database connection or permissions issue. Maybe you don't have CREATE permissions for your non-root user? – wesgarrison Oct 21 '10 at 15:10
  • Got the rake db:create to work by simply updating my LoadModules in apache. It seems those needed to be upgraded for a 64 bit computer to be able to process it. And I did the arch flags for mysql. When I run rake db:create it says it already exists now. So that works. But I still get the original geocode error if I do `rake db:migrate` or `rake db:test:prepare` or `script/server` – Trip Oct 21 '10 at 20:31
  • *blink* Updating Apache fixed mysql? Woah. Try removing that initializer (/config/initializers/geocode.rb) since running rake loads up your app, including environment and initializers. – wesgarrison Oct 22 '10 at 03:12
  • Clever! Well that definately got me through a majority of the migrations but it looks like its actually used somewhere with a `acts_as_geocodable` method in a few spots. So I'm going to put it back. :D – Trip Oct 22 '10 at 12:25
  • Sounds like you're back to getting Geocode/Geokit working as the root fix. – wesgarrison Oct 22 '10 at 21:57