You can clone with
HTTPS or Subversion.
I'm using activeadmin-mongoid with Rails 3.2.13 and Mongoid 3.1.4, and I'm trying to view an embedded document in the admin interface, but I get Document(s) not found for class ApiApplication with id(s) 51dcba...
Document(s) not found for class ApiApplication with id(s) 51dcba...
I have a User resource that embeds_many api_applications, and it looks like activeadmin-mongoid is using ApiApplication.find, but in Mongoid, that won't work. If a User embeds_many api_applications, you have to do user.api_applications.find(id)
My admin/users.rb show snippet:
show :title => :name do |user|
panel "API Applications" do
table_for user.api_applications do |t|
t.column("Name") do |api_application|
My admin/api_applications.rb has this:
ActiveAdmin.register ApiApplication do
When I view the show page for a particular user, it is displaying the correct ApiApplication for that user, but when I click on the link that should take me to the show view for the ApiApplication, I get that document not found error.
Note that this works fine if I use has_many and belongs_to in my Mongoid models instead.
Is this a known issue with embedded documents?
After applying @mabotelh's solution in issue #38, I am now able to view the embedded document. However, when I try to edit it, it fails with the same error as before.
Did you end up finding a solution to this issue?
I have not, so I switched to rails_admin, which supports Mongoid quite nicely.
I think the solution resides in redefining the resource finder in the controller. I'll keep this open until a solution lands on master.
is someone working on this?
Not me. Actually tarting for now I'm looking for a maintainer, will update the readme with details.