-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 ORM agnostic (i.e. works without loading ActiveRecord) #2545
Conversation
- lib\active_admin\orm\active_record - lib\active_admin\orm\mongoid Move comments to ActiveRecord ORM directory Add ActiveRecord/Mongoid type checks to DisplayHelper#pretty_format(object) method
require 'active_admin/batch_actions' | ||
require 'active_admin/filters' | ||
|
||
# Require ORM-specific plugins | ||
require 'active_admin/orm/active_record' if defined?(::ActiveRecord) | ||
require 'active_admin/orm/mongoid' if defined?(::Mongoid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if both ActiveRecord and Mongoid are present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, both will load. As long as the plugins within the directories don't conflict with each other, should not be a problem. (Currently there are no Mongoid plugins, so no conflicts). We could add a global config option to AA so user can control which set(s) to load.
@daxter committed change as per your request |
No, the problem was one of indentation. The code is currently like this: case foo
when Bar
baz
end When it should be like this: case foo
when Bar
baz
end There was nothing wrong with the nested if statement. |
…om case statement
Ah oops. Well, I've now fixed the indentation and I've kept the procs because it looks nicer anyway. |
Okay, looks good. Thanks for taking the time to contribute. |
Make ActiveAdmin ORM agnostic (i.e. works without loading ActiveRecord)
Hi, any ideas how to solve this??
|
@fred there was probably a code change done since my original commit. You'll have to raise a new PR and put a |
It'd be nice to have a test or two to confirm this doesn't happen in the future, but the test suite is already so slow :-/ |
Its simple to do--just set |
Thanks @johnnyshields hope to the pull request in. |
Move Comments plugin to ActiveRecord ORM directory. Comments support is AR-only for now.
Add ActiveRecord/Mongoid type checks to DisplayHelper#pretty_format(object) method