Вопрос

Im running into a weird error whenever I invoke rails g model, or rails s. Application has been running fine and just noticed it now that I want to add a new Model.

Here's the stack trace for running rails g model my_model name:string, rails c and rails g controller test_controller:

/root/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:156:in `split': bad URI(is not URI?):  (URI::InvalidURIError)
from /root/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:174:in `parse'
from /root/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:628:in `parse'
from /root/my_project/config/initializers/redis.rb:1:in `<top (required)>'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /root/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rails-dev-boost-60a39d477c26/lib/rails_development_boost/loadable_patch.rb:14:in `load'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/engine.rb:587:in `each'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /root/my_project/config/environment.rb:5:in `<top (required)>'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/application.rb:103:in `require'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
from /root/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.11/lib/rails/commands.rb:25:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

Does the problem seem to be with the version of rails I'm using? I haven't made any changes so it's weird it's failing right now.

Appreciate your help.

UPDATE

I'm using 3.2.13 and ruby 1.9.2p290

UPDATE #2

Trying these commands on other projects on the same machine and user yield no error...

Please help! :(

Это было полезно?

Решение

Found the issue, there was a missing ENV variable in development, which was being parsed by URI.parse, and was sent nil, which caused the error.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top