After inspecting the whole thing myself, this is the problem:
Rails puts the "fields_with_error" div around the checkbox. There are several possible ways to solve this, the most straightforward would be applying a css rule to "fields_with_error"
.field_with_errors {
display: inline;
}
OR change the default behavior by adding this to config/application.rb
config.action_view.field_error_proc = Proc.new { |html_tag, instance|
"#{html_tag}".html_safe
}
This needs an application restart to take effect! It will wrap the fields_with_error div around label.
In any case change error-explain span to
<div class="error-explain">
<%= @contact.errors[:email].first %>
</div>
Have fun ;)
NOTE: I used the following markup:
<label for="contact_ホーチミン">
<%= f.check_box :city_ids, {multiple: true}, "1", nil %> ホーチミン
</label>
<label for="contact_ハノイ">
<%= f.check_box :city_ids, {multiple: true}, "2", nil %> ハノイ
</label>
...