I want to show 2 sets of objects in a select input separated by "---- New values ----".
This is what I did:
separator = ['---- New categories ----', nil]
@collection = objects1 + [separator] + objects2
However, the separator lines appears as blank. Removing objects1 and objects2 displays the separator correctly, yet alone. Isn't it possible to mix in different types in the collection array?
I am using mongoid, if that's important.
I'm not sure why this isn't working, haven't looked through the code yet. Did you try separator = ['---- New categories ----',''] (an empty string) by any chance? Would you be able to create a pull request with a failing spec and maybe even a patch?
separator = ['---- New categories ----','']
An empty string has the same problem. I will try looking into the code.
Just created a pull request with a failing spec.
Closing this, as it's an issue with standard Rails select helper. Details and suggested work-arounds can be found in #961.