Ruby on Rails Question:
Whats the difference between symbol and string?
Answer:
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]
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]
Previous Question | Next Question |
what the difference between static scaffolding and Dynamic scaffolding? | What is session and cookies? |