Gem active_admin 兼容 Rails 4 吗?

diguage · 2013年07月29日 · 最后由 pynix 回复于 2014年01月05日 · 6726 次阅读

我想创建一个 Rails 4 工程后台,想用active_admin。但是发现一些问题。不知是不是兼容性的问题,麻烦用过的朋友给指点一下。

Gem 声明

gem 包的声明如下:

gem "activeadmin", "0.6.0"

bundle 报错

bundle install 的时候报错。错误信息如下:

> bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    activeadmin (= 0.6.0) ruby depends on
      railties (~> 3.1) ruby

    sass-rails (= 4.0.0) ruby depends on
      railties (4.0.0)

Bundler could not find compatible versions for gem "actionpack":
  In Gemfile:
    activeadmin (= 0.6.0) ruby depends on
      actionpack (~> 3.0.0.rc2) ruby

    rails (= 4.0.0) ruby depends on
      actionpack (4.0.0)

不在测试中挂掉,就在测试中重生

我就根据提示,安装gem install railties。但是,再次bundle install,还是报原来的错。真实郁闷!看来“在测试中挂掉”了!

请问:active_admin 这个 gem 包兼容 Rails 4 吗?

附录

Gemfile 内容

source 'https://rubygems.org'
ruby '2.0.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

gem "mysql2", "0.3.13"

gem "carrierwave", "0.9.0"

gem "kaminari", "0.14.1"
gem "kaminari-bootstrap", "0.1.3"

gem "faker", "1.2.0"

gem "activeadmin", "0.6.0"

# Use sqlite3 as the database for Active Record
group :development do
end

group :test do
  gem 'selenium-webdriver', '2.0.0'
  gem 'capybara', '2.1.0'
end

group :deployment, :test do
  gem 'rspec-rails', '2.13.1'
end

group :production do
  gem "unicorn", "4.6.3"
end

# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails', '2.2.1'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', '0.3.20', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

Gemfile.lock 文件

bundle install时报错了,感觉这个文件貌似不对,但是还是贴出来吧,希望有所帮助。

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.0.0)
      actionpack (= 4.0.0)
      mail (~> 2.5.3)
    actionpack (4.0.0)
      activesupport (= 4.0.0)
      builder (~> 3.1.0)
      erubis (~> 2.7.0)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    activemodel (4.0.0)
      activesupport (= 4.0.0)
      builder (~> 3.1.0)
    activerecord (4.0.0)
      activemodel (= 4.0.0)
      activerecord-deprecated_finders (~> 1.0.2)
      activesupport (= 4.0.0)
      arel (~> 4.0.0)
    activerecord-deprecated_finders (1.0.3)
    activesupport (4.0.0)
      i18n (~> 0.6, >= 0.6.4)
      minitest (~> 4.2)
      multi_json (~> 1.3)
      thread_safe (~> 0.1)
      tzinfo (~> 0.3.37)
    arel (4.0.0)
    atomic (1.1.10)
    builder (3.1.4)
    capybara (2.1.0)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    carrierwave (0.9.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
    childprocess (0.3.9)
      ffi (~> 1.0, >= 1.0.11)
    coffee-rails (4.0.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0.beta, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.3)
    diff-lcs (1.2.4)
    erubis (2.7.0)
    execjs (1.4.0)
      multi_json (~> 1.0)
    faker (1.2.0)
      i18n (~> 0.5)
    ffi (1.9.0)
    hike (1.2.3)
    i18n (0.6.4)
    jbuilder (1.0.2)
      activesupport (>= 3.0.0)
    jquery-rails (2.2.1)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.0)
    json_pure (1.8.0)
    kaminari (0.14.1)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    kaminari-bootstrap (0.1.3)
      kaminari (>= 0.13.0)
      rails
    kgio (2.8.0)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.23)
    mini_portile (0.5.1)
    minitest (4.7.5)
    multi_json (1.7.7)
    mysql2 (0.3.13)
    nokogiri (1.6.0)
      mini_portile (~> 0.5.0)
    polyglot (0.3.3)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.0.0)
      actionmailer (= 4.0.0)
      actionpack (= 4.0.0)
      activerecord (= 4.0.0)
      activesupport (= 4.0.0)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.0.0)
      sprockets-rails (~> 2.0.0)
    railties (4.0.0)
      actionpack (= 4.0.0)
      activesupport (= 4.0.0)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    raindrops (0.11.0)
    rake (10.1.0)
    rdoc (3.12.2)
      json (~> 1.4)
    rspec-core (2.13.1)
    rspec-expectations (2.13.0)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.13.1)
    rspec-rails (2.13.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.13.0)
      rspec-expectations (~> 2.13.0)
      rspec-mocks (~> 2.13.0)
    rubyzip (0.9.9)
    sass (3.2.10)
    sass-rails (4.0.0)
      railties (>= 4.0.0.beta, < 5.0)
      sass (>= 3.1.10)
      sprockets-rails (~> 2.0.0)
    sdoc (0.3.20)
      json (>= 1.1.3)
      rdoc (~> 3.10)
    selenium-webdriver (2.0.0)
      childprocess (>= 0.1.9)
      ffi (>= 1.0.7)
      json_pure
      rubyzip
    sprockets (2.10.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.0.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    thor (0.18.1)
    thread_safe (0.1.2)
      atomic
    tilt (1.4.1)
    treetop (1.4.14)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (1.1.1)
      coffee-rails
    tzinfo (0.3.37)
    uglifier (2.1.1)
      execjs (>= 0.3.0)
      multi_json (~> 1.0, >= 1.0.2)
    unicorn (4.6.3)
      kgio (~> 2.6)
      rack
      raindrops (~> 0.7)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  capybara (= 2.1.0)
  carrierwave (= 0.9.0)
  coffee-rails (= 4.0.0)
  faker (= 1.2.0)
  jbuilder (= 1.0.2)
  jquery-rails (= 2.2.1)
  kaminari (= 0.14.1)
  kaminari-bootstrap (= 0.1.3)
  mysql2 (= 0.3.13)
  rails (= 4.0.0)
  rspec-rails (= 2.13.1)
  sass-rails (= 4.0.0)
  sdoc (= 0.3.20)
  selenium-webdriver (= 2.0.0)
  turbolinks (= 1.1.1)
  uglifier (= 2.1.1)
  unicorn (= 4.6.3)

直接用 gem install 安装的应该是不兼容的,github 里有一个 rails4 的分支,可以试试那个分支。。

gem 'activeadmin', :git => 'git://github.com/gregbell/active_admin.git', :branch => 'rails4'

#1 楼 @yesmeck 看了这个帖子,确实可以了。不过,要求把 jquery-rails 升级到 3.0 以上版本才行。

有了这个东西,django 引以为傲的 admin 菊花被爆出翔了。。。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号