In my model
field :resizable, type: Boolean, default: true
Things I have tried in formtastic:
= f.input :resizable, :as => :check_boxes # This produces two textboxes
= f.input :resizable # This produces an input field
= f.input :resizable, :as => :check_box # This produces an error
The error I get on as: :check_box is:
ActionView::Template::Error (Formtastic::UnknownInputError):
When I use, as: :radio it works.
I don't think :check_box
isn't a formtastic input. Also your form isn't bound to a model (from what I can see)
Just remove the :as param and you should be set.
Follow the example on Ryan Bates' screen cast here
<% semantic_form_for @model do |f| %>
<% f.inputs do %>
<%= f.input :name %>
<%= f.input :born_on %>
<%= f.input :category %>
<%= f.input :female %>
<% end %>
<%= f.buttons %>
<% end %>
If model has a field female which is a boolean then it will render as a checkbox. When you are specifying the :as
arguement you are essentially overriding the default input type for that field.