Support for MongoId #157

sgruhier opened this Issue Dec 16, 2010 · 16 comments


None yet

No description provided.

sferik commented Dec 16, 2010

I would very much like to RailsAdmin to support MongoId but I don't know enough about Mongo to write the code myself or whether its even possible.

As a general goal, RailsAdmin should support multiple ORMs. MerbAdmin supported DataMapper and Sequel (in addition to ActiveRecord) but it became rather burdensome to maintain adapters for each ORM. Ideally, there would be an abstraction for talking to different Ruby ORMs in a unified way, like an expanded ActiveModel.

djsun commented Dec 17, 2010

I'm a big fan of Mongoid!

Why can't RailsAdmin simply support ActiveModel? This would give it support for Mongoid automatically.

sferik commented Dec 17, 2010

@klondike Good question. ActiveModel isn't currently broad enough to cover all the cases where RailsAdmin talks to ActiveRecord. I've been looking at using OrmAdapter to solve this problem (see #105). OrmAdapter currently supports ActiveRecord, DataMapper, and MongoId, which wouldn't solve the problem completely but it would give us a beachhead.

I am not a MongoId user myself, but I would strongly encourage you to addend the bugmash event tomorrow (even if only as a tester, that would be a big help).

I'm really interested in getting this done. Unfortunately, I'm not available for the bugmash tomorrow, but if this doesn't get done then, I'll do it afterwards.

sferik commented Dec 18, 2010

I'm going to close this as a dupe of #105, since integrating OrmAdapter will solve this problem. This will be one of the priorities at the bugmash tomorrow.

Thanks a lot sfreik,I could not make the bugmash :(
I'm sure it will be a great time. I'll follow your commits

I am trying to get rails admin going on Mongoid, going directly to mongoID. You can see my branch here:

My application uses both mysql and mongodb. The code has still a way to go, at this time both sets of models are identified in the application. The objects in a given model are list-ed. Selecting Edit generates an error around line 14

undefined method `model_name' for Mongoid::Criteria:Class
11:         </div>
12:       </div>
13: <%= render(:partial => 'layouts/rails_admin/flash', :locals => {:flash => flash}) -%>
14:       <div id="contentMainNew">
15:         <%= form_for(@object, :url => rails_admin_update_path(:model_name => @abstract_model.to_param, :id =>, :html => { :method => "put", :multipart => true }) do %>
16:           <fieldset>
17:             <%= render(:partial => 'form_section', :collection => RailsAdmin::config(@object).edit.visible_groups) -%>

nice to see mongoid port is progressing !!
I just tryied to install it on a current project (only Mongo, no ActiveRecord) and it asked for RailsAdmin::InstallMigrationsGenerator::ActiveRecord when I run rails generate rails_admin:install_admin

My application is a dual application, mysql and mongodb/id. The Active Record parts are used by Rails Admin to store the History of the actions on the admin, removing Active Record altogether is more complicated. I am sure that part can be ported to Mongoid if there is enough interest, it is not a high priority for my current project.


Has this been completed as I'm still getting issue?

bkoc commented Jan 9, 2012



This is already completed(see #1031).

I'm pretty new to this and I may be posting in the wrong place...

but since I could not get the RailsAdmin history to work out-of-the-box using just mongoid, I did a quick fix of the internal RailsAdmin::History and it now seems to be working... :)

Patch is here ->

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment