Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support for MongoId #157

Closed
sgruhier opened this Issue · 16 comments

12 participants

Sébastien Gruhier Erik Michaels-Ober David James Eric Mill Ethan Gunderson Marius Tim Oxley Tom Andrews Barış Koç Akshat Pradhan Mitsuhiro Shibuya fungl164
Sébastien Gruhier

No description provided.

Erik Michaels-Ober
Owner

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.

David James

I'm a big fan of Mongoid!

Eric Mill

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

Erik Michaels-Ober
Owner

@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).

Ethan Gunderson

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.

Erik Michaels-Ober
Owner

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.

Sébastien Gruhier

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

Marius

I am trying to get rails admin going on Mongoid, going directly to mongoID. You can see my branch here:
https://github.com/yaptv/rails_admin/commits/mongoid

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 => @object.id), :html => { :method => "put", :multipart => true }) do %>
16: <fieldset>
17: <%= render(:partial => 'form_section', :collection => RailsAdmin::config(@object).edit.visible_groups) -%>
Sébastien Gruhier

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

Marius

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.

Tom Andrews

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

Barış Koç

+1

Mitsuhiro Shibuya
Collaborator

This is already completed(see #1031).

fungl164

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 -> https://github.com/fungl164/rails_admin/blob/master/lib/rails_admin/extensions/history/history.rb

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.