Ruby on rails f.label for a check box


I have a block of code in my view like this:

<% @map[value].each do |i| %>

<%= f.check_box(i)%> <%= f.label(i)%><br />

<% end %>

The value 'i' is having string like a_b_c. But it is displayed as a b c without underscores on the view. Please let me know how to print the string as it is on the page without trimming the underscores. Also please let me know why f.label is trimming the underscores. Thanks


label is helpful for 80% of the cases where you pass it a property symbol, which will often contain underscores. It strips out the underscores when generating the label text because most of the time you don't want the label to read something like First_Name.

You can pass a string as a second argument to override what the text of the label appears as.

<%= f.label(i, "a_b_c") %>

So maybe you can try something like this?

<%= f.label(i, i) %>


  • How to see all of the answers in SWI-Prolog without pressing spacebar?
  • JavaScript: Print previous 12 months — “March” prints twice?
  • Perl is respecting '
  • How to Dynamically Remove component in ComponentResolveFactory
  • Reducing memory requirements for convolutional neural network
  • Inject Javascript code into a web page
  • How to use multi dimensional STL vector in MPI
  • How would I make a polygon based on the relative positions of markers in google maps?
  • Pass multiple lines of stdin input to interactive Java command line program, non-interactively
  • Gitlab: copy project to other git lab repository
  • connect.cookieParser and connect.session
  • Validating my form with Jquery
  • VBScript InputBox and Help Files
  • python selenium scraping tbody
  • Query takes almost two seconds but matches only two rows - why isn't the index helping?
  • How to redirect into different page by user type in php and mysql
  • How do I use libcurl to printf a remote FTP directory listing?
  • xpath assertion failure with dynamic xpath
  • how to run a different select statement based on condition in Hive SQL
  • How to define something in JavaScript [closed]
  • gnuplot - How to make zmin equal to zmax keeeping autoscale on z axis
  • Floating parent div grows to hypothetical width of floating child div
  • LinkedIn API: Access Denied when getting Access Token
  • JQuery: Infinite input select
  • Neo4j…how to get a visual representation of my data?
  • Print Longitude and Latitude in textbox Android
  • Cloud Code: Creating a Parse.File from URL
  • Terminal run dalvikvm with am.jar
  • reshape/remould data frame to create normalized bar chart and pie chart
  • How to handle div that is created dynamically in a table
  • read part of h5 dataset python
  • Bitrate JWplayer
  • Make checkout phone field optional for specific countries in WooCommerce
  • Accessing Arguments, Workflow Variables from custom activities
  • Firebase: How to read from external DB?
  • convert json to excel in java
  • No OpKernel was registered to support Op 'Conv2D' with these attrs
  • How to handle a codeigniter PDF generator
  • ReferenceError: TextEncoder is not defined
  • How to check if object is null in Java?