I'm having a problem where I've successfully registered a resource in ActiveAdmin, but I can't create or update any records. I think it's due to a namespacing issue. Can I override it using an option while registering the resource?
I'm building a Rails Engine that registers AA resources from within the engine. I followed the instructions here.
My engine contains lib/admin/myengine/myresources.rb
if defined?(ActiveAdmin)
ActiveAdmin.register Myengine::Myresource do
end
end
In the test/dummy app, the relevant schema looks like:
create_table "myengine_myresources", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
When I run the dummy app server, I successfully navigate to http://localhost:3000/admin/myengine_myresources and click 'New Myengine Myresource'
I type in a name and click 'Create Myresource', but it treats the request as if I've submitted blank attribute values.
The server log shows:
Started POST "/admin/myengine_myresources" for ::1 at 2015-12-02 11:13:52 -0800
Processing by Admin::MyengineMyresourcesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"stuff", "myresource"=>{"name"=>"Arbitrary Name"}, "commit"=>"Create Myresource"}
(0.1ms) begin transaction
(0.1ms) rollback transaction
Rendered /Users/me/.rvm/gems/ruby-2.2.3/gems/activeadmin-1.0.0.pre2/app/views/active_admin/resource/new.html.arb (190.7ms)
Completed 200 OK in 231ms (Views: 199.4ms | ActiveRecord: 0.2ms)
My working theory is that the params need to be inside :myengine_myresource rather than just :myresource.
Any ideas on how to get that working?