Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make activeadmin-mongoid play nice with ActiveRecord Resources #30

Merged
merged 13 commits into from
Jan 8, 2014

Conversation

profmaad
Copy link
Contributor

I am developing a Rails application utilising both ActiveRecord and Mongoid.
I use ActiveAdmin and activeadmin-mongoid.

Since activeadmin-mongoid directly monkeypatches ActiveAdmin, it destroys functionality for ActiveRecord-based resources.

This patch first checks whether the resource is Mongoid-based, and if not just calls the original ActiveAdmin implementation.

It adds the necessity to add

before_filter { @skip_sidebar = true }

to your mongoid-based resources.

@kushkella
Copy link

@profmaad the changes to the resource file break the active-mongoid. With my application I can now only see active record resources in active admin, while mongoid resources fail.

@profmaad
Copy link
Contributor Author

@kushkella Could you be a bit more specific? What is breaking for you? Any error messages?

I am running a production system with this and both Mongoid and ActiveRecord resources work fine, as long as you add

before_filter { @skip_sidebar = true }

to your Mongoid-based resources.

@kushkella
Copy link

Thanks, i will try this.

@elia
Copy link
Member

elia commented Feb 16, 2013

@profmaad I did a bunch of merges including some support for the sidebar can you try to rebase the changes on the master branch?

On a side note this approach (keeping original functionality active) is something I like very much since the the™ path that can lead to a merge into active_admin itself.

@profmaad
Copy link
Contributor Author

profmaad commented Jan 5, 2014

I finally upgraded to ActiveAdmin 0.6 and activeadmin-mongoid 0.3.0 today and got around to rebasing onto 0.3.0.

The changes required to make it (seemingly) work with a mixed mongoid and activerecord setup were pretty small.
The pull request should be updated to reflect these changes.

elia added a commit that referenced this pull request Jan 8, 2014
Make activeadmin-mongoid play nice with ActiveRecord Resources
@elia elia merged commit 99999af into activeadmin:master Jan 8, 2014
@elia
Copy link
Member

elia commented Jan 8, 2014

thanks! seems good for a 0.3.1 release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants