On Jul 9, 8:44 am, Michael Pavling <[email protected]> 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.

For what it's worth, reject{|q| q.nil?} is the same as compact

Fred

-- 
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.

Reply via email to