Fixes #10803: Return nil if no resource_type when creating a filter.
In some instances, such as during DB seed, when a filter is being created for the first time the before_validation callback to build_taxonomy_search is triggered. Since, the filter hasn't been saved, there are no permissions connected to the filter yet when the 'permissions.first.try(:resource_type)' call is made generating the resource_type. This in turn leads get_resource_class to call constantize on 'nil' and throw an exception which then appears throughout the db:seed log.
Related issues
Bug #10803: NoMethodError: undefined method `constantize' for nil:NilClass throughout db:seed log
Fixes #10803: Return nil if no resource_type when creating a filter.
In some instances, such as during DB seed, when a filter is being
created for the first time the before_validation callback to
build_taxonomy_search is triggered. Since, the filter hasn't been
saved, there are no permissions connected to the filter yet when
the 'permissions.first.try(:resource_type)' call is made generating
the resource_type. This in turn leads get_resource_class to call
constantize on 'nil' and throw an exception which then appears
throughout the db:seed log.