I followed the guide in the wiki to use my models from my engine in my main-app with active admin.
The only thing I must change (that doesn't mentioned in the wiki) was this:
if defined?(ActiveAdmin)
ActiveAdmin.register Blog::Category do
end
end
I just added: Blog::
.
In my engine "Blog" I added a model named "category" with a name:string attribute. But when I add one in active admin the field name wasn't saved in the database. My request parameters are:
{"utf8"=>"✓", "authenticity_token"=>"PzKDTcoJZ6Sy2tXgw9WSwXiR7aZp81lOtBvfD5Ec3F72H5L7MEMLjlOFgKWQBo2U4n9mPc7AgjcIS3MTIY2nZA==", "category"=>{"name"=>"asdasd"}, "commit"=>"Update Category", "id"=>"1"}
any ideas why it isn't saved in the databse? When I create a new one, the record is created but without my input.
I ran into the same problem. I was able to get the resources to save properly by overriding the activeadmin controller actions (in e.g. app/admin/category.rb) like this
I'm not sure exactly what's going on in the default case yet, but my guess is that the activeadmin controller action is not creating the object in the right namespace - that is, it does something like
@category = Category.new
rather than@category = Blog::Category.new
. A similar override appears to be necessary for the:update
action as well.