1

我正在学习 ruby​​ on rails

但是不明白为什么有些变量有两个前端,请给我解释一下,例如一段代码:

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


我不明白,为什么 :session_key => "ruby_cookies" 以两点开头,
而且似乎是带有那个箭头的哈希 =>

我学了Ruby的基础知识,这些都没有,只知道有类变量@,:,


另一个例子:

<%@Posts.each 做 | 发表 |%>

<% = link_to 'Destroy', post, :confirm => '你确定吗?'
:method => :delete%> </td>
</tr>
other[:variable] <%end%>


为什么 :confirm => 'Are you sure',而 other[:variable] 以两点开头?

谢谢

4

1 回答 1

0

它们是命名符号,它们是不同的变量

于 2013-01-09T16:49:04.503 回答