So I was trying to configure my rails 3.0.9 app to use HTTPS and SSL by adding the following line to my environment configuration
config.middleware.insert_before ActionDispatch::Static, "Rack::SSL"
and defining Rack::SSL dependency in my Gemfile
gem 'rack-ssl', :require => 'rack/ssl'
For some reason that didn't wor开发者_StackOverflow社区k so I tried to roll back the gem dependency first by undoing the above and then
gem cleanup
that didn't work so I did the following stupid thing:
gem uninstall rack-ssl
and
gem uninstall railties
which uninstalled both railties 3.0.9 and 3.1.0.
Obviously I did a few bad things along the way but now I can't run rails and I get the following error:
/Users/mgriffel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in
to_specs': Could not find railties (= 3.0.9) amongst [ZenTest-4.6.2, abstract-1.0.0, actionmailer-3.1.0, actionmailer-3.0.9, actionpack-3.1.0, actionpack-3.0.9, activemodel-3.1.0, activemodel-3.0.9, activerecord-3.1.0, activerecord-3.0.9, activeresource-3.1.0, activeresource-3.0.9, activesupport-3.1.0, activesupport-3.0.9, addressable-2.2.6, annotate-2.4.0, arel-2.2.1, arel-2.0.10, autotest-4.4.6, autotest-fsevent-0.2.4, autotest-growl-0.2.9, autotest-rails-pure-4.1.2, bcrypt-ruby-3.0.1, builder-3.0.0, builder-2.1.2, bundler-1.0.18, diff-lcs-1.1.3, erubis-2.7.0, erubis-2.6.6, factory_girl-1.3.3, factory_girl_rails-1.0, gravatar_image_tag-1.0.0.pre2, heroku-2.8.0, hike-1.2.1, i18n-0.6.0, i18n-0.5.0, launchy-2.0.5, mail-2.3.0, mail-2.2.19, mime-types-1.16, multi_json-1.0.3, nokogiri-1.5.0, polyglot-0.3.2, rack-1.3.3, rack-1.2.4, rack-cache-1.0.3, rack-mount-0.8.3, rack-mount-0.6.14, rack-test-0.6.1, rack-test-0.5.7, rails-3.0.9, rake-0.9.2, rdoc-3.9.4, rest-client-1.6.7, rspec-2.6.0, rspec-core-2.6.4, rspec-expectations-2.6.0, rspec-mocks-2.6.0, rspec-rails-2.6.1, rubyzip-0.9.4, spork-0.9.0.rc8, sprockets-2.0.0, sqlite3-1.3.3, sys-uname-0.8.6, term-ansicolor-1.0.6, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.30, tzinfo-0.3.29, webrat-0.7.1] (Gem::LoadError) from /Users/mgriffel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:759:in
block in activate_dependencies' from /Users/mgriffel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:756:ineach' from /Users/mgriffel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:756:in
activate_dependencies' from /Users/mgriffel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:741:inactivate' from /Users/mgriffel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1183:in
gem' from /Users/mgriffel/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/rails:18:in `'
Can anyone help me? I tried uninstalling and reinstalling the rails gem but nothing's working.
edit: I realized that switching to the system version of ruby (from my rvm default) fixed the problem, so I uninstalled and then reinstalled rvm, ruby, rails, and all of my gems. That didn't entirely fix the problem, but I decided to take a quick look at my Gemfile.lock and noticed that rack-ssl was still in there. Deleting that did the trick.
You should be able to restore it with gem install railties -v 3.0.9
精彩评论