【发布时间】:2012-04-13 04:18:20
【问题描述】:
each 中的&:valid? 是什么意思?
我见过.each do |r| 或其他什么,但不确定这个是如何工作的?
【问题讨论】:
-
我认为这只是
temps.collect{ |t| t.valid == true}的简写 -
你可以阅读更多关于它here
-
…What is this
&:lastRuby Construct Called?,What do you call the&:operator in Ruby?,What doesmap(&:name)do in this Ruby code?,What are:+and&+in ruby?,&:views_countinPost.published.collect(&:views_count),Ruby Proc Syntax,How does “(1..4).inject(&:+)” work in Ruby,… -
…What does following statement
&:property?、What does the&mean in the following ruby syntax?、Why would one use the unary operator on a property in ruby? i.e&:first、how doesArray#maphave parameter to do something like this?、what does&:mean in ruby, is it a block mixed with a symbol? 和 what is the functionality of “&:” operator in ruby?。
标签: ruby-on-rails ruby