Whats the difference between symbol and string?

Answer Posted / surekha matte

Rails makes extensive use of symbols. A symbol looks like a
variable symbols name, but it’s prefixed with a colon.
Examples of symbols include :action,:line_items, and :id.

Rails uses symbols to identify things. In particular, it
uses them as keys when naming method parameters and looking
things up in hashes. For example:
redirect_to :action => "edit", :id => params[:id]

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the three methods to install ruby on rails?

482


What does ruby name refer to?

539


How can you protect filter methods in rails?

477


what are benefits of using active record as opposed to raw sql queries?

492


What is the architecture of Model views and controllers

2207






How you run your rails application without creating databases?

456


Tell me what is rails migration?

457


Explain dry in rails?

498


What do you understand by rails migration and what it can do?

444


Explain me what is the naming convention in rails?

440


what is a rails migration? Write up a short example of a simple rails migration with a table called customers, a string column called name, and a text column called description?

490


What are the various changes between the rails version 2 and 3?

463


Tell me what is the difference between the observers and callbacks in ruby on rails?

452


What is the purpose of auto_load in ruby?

502


how you can run Rails application without creating databases?

459