Created
April 11, 2013 10:21
-
-
Save 1dolinski/5362279 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_tag("/search", :method => "get") do %> | |
<%= label_tag(:q, "Search for:") %> | |
<%= text_field_tag(:q) %> | |
<%= submit_tag("Search") %> | |
<% end %> | |
This will generate the following HTML: | |
<form accept-charset="UTF-8" action="/search" method="get"> | |
<label for="q">Search for:</label> | |
<input id="q" name="q" type="text" /> | |
<input name="commit" type="submit" value="Search" /> | |
</form> |
Apparently the reason is that strings are garbage collecting while symbols are not
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for #=> text_field_tag(:q)
Why are we passing a :q? Why not "q" .. the user puts in :q and the code runs :q.to_s ... what is the benefit of this?