I am working on the front end of a Rails 3.1 application. We use Twitter Bootstrap as the CSS Framework, we are developing as an authentication manager and I18n stone for localization.
This is the syntax for developing a flag with its label
<%= f.label :remember_me %> <%= f.check_box :remember_me %>
And this, of course, generated HTML
<label for="user_remember_me">Ricordati di me</label> <input name="user[remember_me]" type="hidden" value="0"> <input id="user_remember_me" name="user[remember_me]" type="checkbox" value="1">
Since Bootstrap adds this rule for display: block labels, the label and flag are not on the same line. To have the same line, I need HTML output like this
<label for="user_remember_me"> Ricordati di me <input name="user[remember_me]" type="hidden" value="0"> <input id="user_remember_me" name="user[remember_me]" type="checkbox" value="1"> </label>
As shown in the documentation markup form
You noticed that the label text is in Italian, the team member who provided the localization for Devised worked hard to find out how to do this, and I donβt want to get him to work on it again by introducing new localized strings.
I am well aware that the FormBuidler label method takes a block as an argument so that I can do
<% f.label :remeber_me do %> <%= f.check_box :remember_me %> <% end %>
But this leads to HTML whitout HTML! oo To be specific, this is what I get:
<input name="user[remember_me]" type="hidden" value="0"> <input id="user_remember_me" name="user[remember_me]" type="checkbox" value="1">
I tried to look in the source code, the f.label method calls label , but I can only see that if there is a block, the text will not be printed and that the label and block will display label_tag template_object .
Before I dive into digging the source code and stay awake at night, I decided to wait a bit and ask the lifesafer community from StackOverflow about this.
Am I missing something? Am I f.label with the wrong block? Missing some parameter?
Thanks!!