This would seem to be a fairly straightforward question but I couldn't seem to find anything about it in the docs. I have a model events
which has_many
nested performances
(which has an event_id
). Now I could use something like:
https://github.com/nickcharlton/administrate-field-nested_has_many
But it had a bunch of jquery dependencies as it uses cocoon and it just seemed like too much work for my use case. I would just like to send one param, the event_id
onto the nested controller so that it's value is prefilled but by default, this doesn't seem to work.
eg I just want to provide a link like so: /admin/performances/new?performance_event_id=751
And then have the select field selected.
It seems like an easy thing to do but I couldn't find anything in the documentation short of creating my own custom field to overwrite the default has_many
field so that it will look for a param value? Or if I should add something into the controller to set this on the new action?
Does anyone have any thoughts?
Thanks
The gem is made to be simple stupid, so it does not support these kind of functionalities. It is as you say, if you want to send custom params you either need to create a customized field, use JS or create a custom controller action. In the documentation they recommend to use custom fields, ref: https://administrate-demo.herokuapp.com/adding_custom_field_types