RailsAdmin::DEFAULT_CURRENT_USER is actually a Proc object, so it'd
need to be evaluated to return a value. Unfortunately that wouldn't
work either as it meant to be used in the scope of the controller or
view (it uses the request object only available in that context).
I think I gave poor advice to begin with. Perhaps a cleaner approach
would be to define user_id as a hidden input field with default value
of current user. Something like this (untested):
...
field :user_id
# Set the type of form helper to use
view_helper :hidden_field
# Use the generic partial instead of the belongs_to one so proper
view_helper gets used
partial :form_field
# Override value method for the eigenklass of this field's instances
in create and update views
def value
bindings[:view]._
current_user.id
end
end
...
It's still very hacky, so I'll try to think of a better way to solve
this kind of stuff in the upcoming renovation of config dsl.
P.