How are symbols used to identify arguments in ruby methods

后端 未结 5 1175
星月不相逢
星月不相逢 2021-02-01 23:20

I am learning rails and going back to ruby to understand how methods in rails (and ruby really work). When I see method calls like:

validates :first_name, :presen         


        
5条回答
  •  青春惊慌失措
    2021-02-01 23:43

    I think all replies have missed the point of question; and the fact it is asked by someone who is - I guess - not clear on what a symbol is ?

    As a newcomer to Ruby I had similar confusions and to me an answer like following would have made more sense

    Method Arguments are local variables populated by passed in values.

    You cant use symbols as Arguments by themselves, as you cant change value of a symbol.

提交回复
热议问题