rails中的Active_Model错误 [英] Active_Model error in rails

查看:109
本文介绍了rails中的Active_Model错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我回到了我正在开发的一个rails项目上,命令rails s开始失败。终端推荐我运行捆绑安装。当我收到以下消息时:

  Bundler无法找到适用于gemactivemodel的兼容版本:
In Gemfile:
protected_attributes(> = 0)ruby依赖于
activemodel(< 5.0,> = 4.0.0.beta)ruby

rails(> = 0 )ruby取决于
activemodel(3.2.12)

我更新了ruby和rails 。我重新安装了活动模型并重新启动了终端。



我的宝石文件非常简单:

  gem'rails'
gem'jquery-rails'
gem'devise'
gem'simple_form'
gem'protected_attributes'

组:生产do
gem'pg'
结束

组:开发,:测试
gem'sqlite3'
结束

组:资产do
gem'sass-rails','〜> 3.2.3'
gem'咖啡栏','〜> 3.2.1'
gem'bootstrap-sass','〜> 2.2.2.0'
gem'bootstrap'
end


解决方案

删除你的Gemfile.lock并运行

$ ul $ $ b $ li $ rm Gemfile.lock


  • 捆绑安装

    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
    

    解决方案

    Remove your Gemfile.lock and run

    • rm Gemfile.lock

      and

    • bundle install

    这篇关于rails中的Active_Model错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆