1

I am learning ruby on rails

but do not understand why some variables have two front points, please explain to me, for example a piece of code either:

class ApplicationController < ActionController::Base
session :session_key => "ruby_cookies"
end


I do not understand, why :session_key => "ruby_cookies" begins with two points,
and also seems a hash with that arrow =>

I learned the basics of Ruby, and there was none of this, just know that the have class variables @,:,


another example:

<% @ Posts.each do | post |%>

<% = link_to 'Destroy', post, :confirm => 'Are you sure?'
: method => :delete%> </ td>
</ tr>
other[:variable] <% End%>


why :confirm => 'Are you sure', and other[:variable] begins with two points?,

thanks

dexter00x
  • 879
  • 2
  • 14
  • 25
  • See here: http://stackoverflow.com/questions/6337897/what-is-the-colon-operator-in-ruby. It's a symbol in Ruby. – Justin Oct 03 '12 at 02:31
  • In the latest version of Ruby, you can also do `session_key: "ruby_cookies"` instead of the version you have above or `method: :delete` in the other case. – Justin Oct 03 '12 at 02:31

1 Answers1

0

they are named symbols, they are different of variables

dexter00x
  • 879
  • 2
  • 14
  • 25