?
Solved

text_field_for  easy one

Posted on 2008-10-06
2
Medium Priority
?
309 Views
Last Modified: 2013-11-13
Hi, I'm an experienced .NET web developer trying to get a handle on Rails.  I'm trying to work through this example,  http://www.railshosting.org/#live_searching   but there are a few things I don't understand.  Here's the first post:

<= text_field_tag(:search) %>   What does the (:search) syntax mean exactly.  I'm sure I was looking in the wrong place, but I can't for the life of me find an explanation of what  the difference is (if any, I get the feeling they're the same) between text_field_tag(:search)  and text_field_tag("search")

Thanks!
0
Comment
Question by:ARACK04
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
wesgarrison earned 2000 total points
ID: 22652621
:search is a Symbol.  'search' is a String.

Here's the rdoc for Symbol:
http://www.ruby-doc.org/core/classes/Symbol.html

Check out that method:
http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001733

Inside that method, it converts the symbol to a string.  It just looks cleaner and it's easier to type.

Rails uses Symbols for named parameters a lot, a la:
 :conditions => 'true', :order => 'desc', ...

Like, named parameters in a way.
0
 

Author Comment

by:ARACK04
ID: 22652913
Thanks, that was a huge help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question