Edit: The gem actually installs correctly when I use sudo rake gems:install. However, I’m having trouble with the loading part. When I try to start script/console, I get this message:
cannot load such file -- weatherman-api ...
This happens even though the installation command completed successfully. The error appears to show up two times in a row.
-=-=-
I want to add current weather data functionality to my Rails app.
I found a gem called weatherman-api that looks like it would work well for what I need. However, I’m running into problems trying to get it working properly.
I added this line to my environment configuration:
hey, it could also help to check if the gem is included in your Gemfile. sometimes, just adding to the config doesn’t cut it. restarting the server after those changes can also fix weird loading issues. good luck!
I hit this same issue with an older Rails version. The gem probably installed fine, but Rails isn’t loading the require path on startup. Try adding require 'weatherman-api' in your config/environment.rb file after the Rails::Initializer block. You might also need to run rake gems:build after installation - some gems with native extensions need this step. Since geokit works fine, your gem setup’s probably okay. This looks like a loading order problem. You can test if the gem’s accessible by requiring it directly in script/console.
That’s frustrating! Run gem list first to check if weatherman-api actually installed. GitHub gems can be finicky. Also try require 'weatherman_api' with underscores instead of dashes - GitHub gems often switch naming conventions when you require them.
This looks like a path resolution issue, not an installation problem. The weatherman-api gem from GitHub probably has a different require name than the gem name itself. Check the gem’s docs or lib directory to see what the actual require path should be. You might need to explicitly require it in your environment.rb file with something like require 'weatherman_api' (note the underscore) or whatever the library is actually called. Also double-check that the gem installed to the right Ruby path - since you used sudo, it might’ve installed to system Ruby while your Rails app runs under a different Ruby version.