问题
I went back to a rails project I was working on and the command "rails s" started to fail. The Terminal recommended that I run a bundle install. When I did I received the following message:
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
protected_attributes (>= 0) ruby depends on
activemodel (< 5.0, >= 4.0.0.beta) ruby
rails (>= 0) ruby depends on
activemodel (3.2.12)
I have updated both ruby and rails. I've re-installed active model and restarted my terminal.
My gems file is very simple:
gem 'rails'
gem 'jquery-rails'
gem 'devise'
gem 'simple_form'
gem 'protected_attributes'
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '~> 2.2.2.0'
gem 'bootstrap'
end
回答1:
Remove your Gemfile.lock and run
rm Gemfile.lock
and
bundle install
回答2:
Remove Gemfile.lock
and then bundle if not works then specify rails version in gemfile.
回答3:
have you tried running
gem update activemodel
or
bundle update
回答4:
Bundler has attempted to install Rails 4 and associated gems, but you have some gems fixed at earlier incompatible versions. Either specify a 3.x.x version of Rails or remove the version requirements on your sass-rails
and coffee-rails
gems.
(I took your Gemfile into a sample application and attempted to run a bundle install
--I didn't get the exact error you're seeing but an error of the same cause. Removing the version requirements on those gems solved the issue. Of course that may not be appropriate for your needs!)
来源:https://stackoverflow.com/questions/19530913/active-model-error-in-rails