ActiveAdmin hacks to support Mongoid
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Remove a bunch of unused code (#134) Dec 18, 2018
spec
tasks Fix default rake task Nov 7, 2012
test_app
.gitignore
.rspec
.travis.yml Add travis badge, change Ruby min version and bump gem version Aug 24, 2018
CONDUCT.md Add the Ruby conduct guidelines May 16, 2017
Gemfile Remove unnecessary gemfile (#135) Dec 26, 2018
Gemfile.lock
LICENSE Vanilla bundle gem Mar 17, 2012
README.md Update README.md Dec 12, 2018
Rakefile Hello travis! May 14, 2013
activeadmin-mongoid.gemspec simplified installation: Dec 12, 2018

README.md

ActiveAdmin-Mongoid

Build Status

Updates

ActiveAdmin is holding off on pulling Mongoid support into the core ActiveAdmin application. This repo was pulled into the ActiveAdmin org from previous work done by Elia Schito, and will be maintained by Nic Boie, JD Guzman, Elia Schito and other ActiveAdmin and community members.

Requirements for version 0.8.0

  • Ruby 2.3.0 or greater. (Note, ruby-2.4.0 fails specs, see this issue)
  • Tested working on Rails 5.1.x
  • Mongoid 6.x (WARNING:, using a Mongoid version >= 6.1.x has resulted in a fair amount of errors seen in the wild. Test your upgrade very carefully with any apps in which you're using this gem with Mongoid >= 6.1.x!)
  • ActiveAdmin 1.3
  • ransack-mongoid - it needs to be explicitly declared in Gemfile, pointing to github's master since it has no releases on rubygems yet.

Previous versions

  • Rails 4.x with Mongoid 5.x use branch rails4-mongoid5
  • Rails 4.x with Mongoid 4.x branch rails4
  • Mongoid 3.x with older versions of rails use v 0.3.0

♻️ INFO

This gem has been brought into the ActiveAdmin org for support and maintenance.

ActiveAdmin::Mongoid

ActiveAdmin hacks to support Mongoid. Some ActiveAdmin features are disabled or not working properly:

  • comments are disabled by default
  • filters are somewhat broken

For more on Mongoid support in ActiveAdmin see this issue.

Installation

Some Gems

Add the following gems to your application's Gemfile, and lock the version:

gem 'activeadmin-mongoid', '0.8.0'
gem 'ransack-mongoid', github: 'activerecord-hackery/ransack-mongoid'

You can safely remove the following lines, since are already activeadmin-mongoid dependencies:

gem 'activeadmin'

Remove Application Dependencies

In your config/application.rb, replace:

require 'rails/all'

with:

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"

NOTE: This gem will NOT work if you use both ActiveRecord AND Mongoid in the same app. rails/all includes elements requiring ActiveRecord::Connection

Bundle & Crank

Execute:

$ bundle
$ rails g devise:install
$ rails g active_admin:install

Check that the generated initializers/devise.rb file requires mongoid orm. You may find a line like this :

require 'devise/orm/mongoid'

Then create an admin user:

$ bundle exec rails console
>> AdminUser.create email: 'admin@example.com', password: 'password', password_confirmation: 'password'

And that's pretty much it !

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright © 2012 Elia Schito. See LICENSE for details.