Active admin install with Rails 4

浪尽此生 提交于 2019-12-17 07:01:26

问题


I got this error when installing active admin on Rails 4

Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
  meta_search (>= 1.1.0.pre) ruby depends on
    actionpack (~> 3.1.0.alpha) ruby

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

I follow this instruction: http://www.activeadmin.info/docs/documentation.html

Anyone help please.


回答1:


Apr 20, 2015 update

For Rails 4 (according to the official github page) use either master:

gem 'activeadmin', github: 'activeadmin'

Or rubygems:

gem 'activeadmin', '~> 1.0.0.pre1'

Feb 14, 2015 update

For Rails 4 (according to the official github page) use:

gem 'activeadmin', github: 'activeadmin'

Sept 4, 2014 update

For Rails 4.0 and 4.1 (according to the official github page) use:

gem 'activeadmin', github: 'activeadmin'

April 24, 2014 update

For Rails 4.1 and 4.0 use master:

gem 'activeadmin', github: 'gregbell/active_admin'

April 13, 2014 update

For Rails 4.1 use master and the following dependency branches:

gem 'activeadmin', github: 'gregbell/active_admin'
gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'formtastic', github: 'justinfrench/formtastic'

For Rails 4.0.X just use master and you should be good to go:

gem 'activeadmin', github: 'gregbell/active_admin'

Note: There's an issue with adding comments to the index page in Rails 4.1. This issue is being tracked here.

September 29, 2013 update

The Rails 4 branch has been merged into master. Now all you need to do is specify:

gem 'activeadmin', github: 'gregbell/active_admin'

August 28, 2013 Updated answer

Was able to build a new rails 4 app up and running with AA just using:

gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4'

Please disregard the older answer. Just add this line to your new rails 4 app Gemfile, run bundle install, run rails g active_admin:install, run rake db:migrate, run bundle exec rails s, go to /admin, and log in with admin@example.com/password and you're good to go! See ActiveAdmin Documentation for more details.

June 30, 2013 Updated answer

Much progress has been made on getting ActiveAdmin and the gems it depends on ready for Rails 4. Please use the following gemfile settings and disregard the bit regarding downgrading jquery-rails to 2.3.0:

gem 'devise',              github: 'plataformatec/devise'
gem 'responders',          github: 'plataformatec/responders'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'ransack',             github: 'ernie/ransack'
gem 'activeadmin',         github: 'gregbell/active_admin', branch: 'rails4'
gem 'formtastic',          github: 'justinfrench/formtastic'

just bundle install (or bundle update, if necessary) and run rails generate active_admin:install (if necessary) to install


Original Answer

I used the following to get ActiveAdmin on my Rails 4.0.0.rc1/JRuby/Puma app up and running on Heroku.

After checking out the following links from the ActiveAdmin github:

Re: Rails 4 problems - Issue #1963

Rails 4 Hacks, Fixes - Pull Request #2120

I added the following to my gemfile:

gem 'devise',              github: 'plataformatec/devise',     branch: 'rails4'
gem 'responders',          github: 'plataformatec/responders'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'ransack',             github: 'ernie/ransack'
gem 'activeadmin',         github: 'akashkamboj/active_admin', branch: 'rails4'
gem 'formtastic',          github: 'justinfrench/formtastic', branch: 'rails4beta'

replace:

gem 'jquery-rails', '3.0.0'

with:

gem 'jquery-rails', '2.3.0'

and bundle install and run the rails generate active_admin:install to install.

Fire up the server, go to root_url/admin and you should see the admin login.




回答2:


January 11, 2016 Updated answer

ActiveAdmin has now Rails 4 full support :

1.0.0 Version, full support of Rails 4) :

gem 'activeadmin', github: 'activeadmin'


0.6 Stable version (may not properly support Rails 4) :

gem 'activeadmin', github: 'activeadmin', branch: '0-6-stable'




回答3:


I have switched to Ubuntu, and that resolved the issue I was having. For some reason, Windows chokes when trying to get a gem that is not on the Ruby source.




回答4:


Thanks for the help, Marc and Oto Brglez. A quick update for the rails 4 implementation. You do not need to use branch '0-6-stable' (that is the current branch as of today), you can instead just use the master branch as noted int he documentation on gregbell's github. https://github.com/gregbell/active_admin




回答5:


Just edit your Gemfile. This all what you need to your ActiveAdmin 1.0.0 works properly with Rails 4.1


Add following lines:

gem 'activeadmin',      github: 'gregbell/active_admin'             # ActiveAdmin backend framework for Rails administration interface
gem 'polyamorous',      github: 'activerecord-hackery/polyamorous'  # Require for ActiveAdmin to work with Rails 4.1
gem 'ransack',          github: 'activerecord-hackery/ransack'      # Require for ActiveAdmin to work with Rails 4.1
gem 'formtastic',       github: 'justinfrench/formtastic'           # Require for ActiveAdmin to work with Rails 4.1
gem 'devise'                                                        # Authentication


来源:https://stackoverflow.com/questions/16426398/active-admin-install-with-rails-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!