Question

Is it possible in ActiveAdmin to specify a different model column for ActiveAdmin to use to look up records against?

The ActiveRecord models are set to use a string as the identifier (the unique slug in this case).

However, due to how the models relationships work means it's making configuring ActiveAdmin a nightmare (things aren't scoped to the correct place, etc)

So I just want to revert to using the record IDs in ActiveAdmin.

Problem is that ActiveAdmin is still using the models id as the slug, so it's failing to find any numeric ids (as it's matchind ID=text)

So I want to basically tell ActiveAdmin to use the ID rather than the model's identifier.

Thanks

----Edit----

The ActiveRecord model has:

def to_param
  slug
end

Which is returning the slug as the unique identifier.

Était-ce utile?

La solution

The way I solved this in the end was to use the Draper gem and write admin decorators for activeadmin.

It worked well enough until I hit issues with nesting.

As activeadmin forms don't use the decorators in the buttons like create and edit.

I ended up just using a flat structure with no nesting which meant the Draper decorators worked fine.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top