# Rails syntax help

**URL:** <https://www.ruby-forum.com/t/rails-syntax-help/176334>\
**Category:** Rails\
**Created:** [September 29, 2009, 9:18am UTC](https://www.ruby-forum.com/t/rails-syntax-help/176334 "2009-09-29T09:18:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![foxpro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/71e660/32.png) [@foxpro](https://www.ruby-forum.com/u/foxpro)\
**Post date:** [September 29, 2009, 9:18am UTC](https://www.ruby-forum.com/t/rails-syntax-help/176334/1 "2009-09-29T09:18:33Z")

</div>

Hi Guys,

I am very new to Ruby and Rails, am trying to understand the syntax of  
it. I got this code from a book but can’t understand what does "\</  
option\>“end.to\_s” do. Here is the complete “view” code. Note: This  
code works fine

## A Simple Form
\<%= start\_form\_tag(:action =\> "show\_formdata") %\>

Text Field: \<%= text\_field\_tag("name", "Aneesha") %\>

Drop-down Selection Box: \<% languages = ["Ruby", "Java", "C#"].map do |lang| "#{lang}"end.to\_s %\>

\<%= select\_tag(“prog\_languages[]”, languages, :multiple =\> “true”)  
%\>

Checkboxes: \<%= check\_box\_tag("operating\_systems[]", "Windows") %\>Windows \<%= check\_box\_tag("operating\_systems[]", "Linux") %\>Linux \<%= check\_box\_tag("operating\_systems[]", "Mac") %\>Mac

\<%= submit\_tag("Submit Form") %\> \<%= end\_form\_tag %\>

---

<div class="post-metadata">

**Author:** ![foxpro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/71e660/32.png) [@foxpro](https://www.ruby-forum.com/u/foxpro)\
**Post date:** [September 29, 2009, 9:23am UTC](https://www.ruby-forum.com/t/rails-syntax-help/176334/2 "2009-09-29T09:23:50Z")

</div>

On Sep 29, 1:53 am, foxpro [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi Guys,
> 
> I am very new to Ruby and Rails, am trying to understand the syntax of  
> it. I got this code from a book but can’t understand what does "\</  
> option\>“end.to\_s” do. Here is the complete “view” code. Note: This  
> code works fine

This is mostly just confusingly formatted. Another way to write it  
would be

\<% languages = [“Ruby”, “Java”, “C#”].map { |lang| “#{lang}\</  
option\>” }.to\_s %\>

You’re also following some very old examples - at least 2 years old.

Fred
