MongoDB Boolean fields (which are of type Boolean) renders text field instead of checkbox.
Must confess I have only tried with the Mongoid wrapper.
We don't support MongoID integration in SimpleForm, but I'll be glad to accept a pull request to make this work.
@rutte would you mind sharing the model you're using with SimpleForm, and the form code? This would help us or someone else to work on this. Thanks.
I'm using default scaffolds, my model looks like this:
field :complete, type: Boolean, default: false
My view looks like this:
= simple_form_for(@scope) do |f|
= f.input :complete
= f.button :submit
The :complete field is rendered as a textfield instead of the expected checkbox for boolean.
Since we don't support Mongoid we can't discovery what kind is the field. You have to pass the type using the :as option.
@rafaelfranca I was thinking about using orm_adapter to solve this issue. Unfortunately it doesn't support column_type or similar method so I was going to add it. Do you think its worth it? Or we don't need another dependency?
I don't think is worth right now since you can use the :as options. Maybe in the future we can support mongoid.
Dirty patch to Mongoid::Document
ARFakeColumn = Struct.new(:type, :limit, :number?)
if fields[attribute_name.to_s].options[:type] == Mongoid::Boolean