Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

text_field_for  easy one

Posted on 2008-10-06
2
Medium Priority
?
313 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below: http://www.rubytips.org/2008/05/13/accessing-windows-api-fro…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

604 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