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

Difference between argument and parameter in ruby on rails ?

460


Explain me what is the role of rails controller?

481


Explain me what is the naming convention in rails?

434


Am Fresher ..,i dont know seven controller methods.am searching in google .but am not getting .help me

1869


What is action cable?

510






Tell me what is ruby on rails?

429


What is rails scaffolding?

585


Explain some features of nested scaffolding.

490


What is a proc ?

546


Explain me the log that has to be seen to report errors in ruby rails?

404


How many types of relationships does a model has?

473


what are helpers and how to use helpers in ror?

524


Explain about Dig, Float and Max?

518


Explain how Rails implements Ajax?

467


How can the filter methods in ruby on rails be protected?

448