One of our most recent projects uses ActiveAdmin with Mongoid 5 and Rails 4.2. Since Rail 5's release, we’d been eyeing up some of the new features, including the use of ActionCable without backports. Unfortunately, there’s a lack of support in ActiveAdmin
1.0 pre-release branches, and despite their efforts to add compatibility, the existing activeadmin-mongoid gem has not been maintained since ActiveAdmin announced out-of-the-box support for Mongoid. We took it upon ourselves to update one of our own
activeadmin-mongoid gem forks and share our work with the Rails community. Our activeadmin-mongoid fork has passed internal testing, and the functionality works fine in our application. Keep in mind, however, that you should fully test your application’s
activeadmin after using the unofficial fork in production. (We cannot guarantee that there are no bugs or missing functionality!)
Here are the gems we are using in production. The specific ref for activeadmin could be updated, but would
require further testing, as this is the ref we have tested against.
gem ‘mongoid’, ‘~> 6.0.0’ # Not yet working with 6.1.x branch
gem ‘kaminari-mongoid’, ‘= 0.1.2’ # Lock due to activeadmin compatibility
gem ‘kaminari’, ‘= 0.17.0’ # Lock due to activeadmin compatibility
gem ‘activeadmin’, git: ‘firstname.lastname@example.org:activeadmin/activeadmin’, ref: ‘6411350c8abf’
gem ‘activeadmin-mongoid’, git: ‘email@example.com:devs-for-change/activeadmin-mongoid’, branch: ‘nb/mongoid-6’
To run the reference app (github), follow these steps:
Install bundle: `bundle`.
Create a user from the console:
`SECRET_KEY_BASE=[secret key base for session] bundle exec rails c`
`AdminUser.create(email: '[email]', password: '[password]', password_confirmation: '[password]')`
`SECRET_KEY_BASE=[secret key base for session] bundle exec rails s`
In this upgrade, we also had to upgrade two other Mongoid-related gems, mongoid-enum and mongoid_token. These have all been tested at a basic level, but
again, there’s no warranty or guarantee of performance. We’re using these against Mongoid 6.0.x.
We’d love to know if you try out these updates in your own project. If you’re interested in learning how WebVolta can build a custom application for your business, use our Contact Us page to reach out!