Thanks michael. the link helps to understand .reject. thanks again
To get a clear pic, is the .all here truely a syntax error or typo or
is it correct?
"self.questions.reject{|q| q.nil?}.all"
can anyone clarify.
- thanks,
radha.
Michael Pavling wrote:
> On 9 July 2010 03:08, RailsFan Radha <[email protected]> wrote:
>> I come from a db world.
>> Can someone interpret this please, "self.questions.reject{|q|
>> q.nil?}.all"
>
> this explains what ".reject" does:
> http://ruby-doc.org/core/classes/Enumerable.html#M003126
>
> So essentially, the line takes the collection of questions that self
> has, and gets rid of those that are nil (fairly self-explanatory if
> you just read the line out loud to yourself ;-)
> TBH, I think the "all" at the end is a syntax error - Array doesn't
> have a .all method, although I'm not at a Ruby console to check.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.