As Divya Bhargov said, if you look at the source code, you will find that the inner call stack should end, as shown below.
# actionpack/lib/action_view/helpers/form_helper.rb ActiveModel::Naming.param_key(SpecialFilter.new)
So, if you really want to do this at your model level, you need to override model_name in your class.
class SpecialFilter < Filter def self.model_name ActiveModel::Name.new(self, nil, "Filter") end end
The parameter for this initializer is ActiveModel :: Name: klass, namespace = nil, name = nil .
But model_name also used somewhere else, such as error_messages_for, so use this with caution.
source share