I come from a db world.
Can someone interpret this please, "self.questions.reject{|q|
q.nil?}.all"
I'm overwhelmed by the syntax in the second line,
"self.questions.reject{|q| q.nil?}.all"
>> def needed_questions
>> self.questions.reject{|q| q.nil?}.all
>> end
>> something like that.
i can somewhat understand self.questions.... but after that it is way
over my head.
I just completed reading "Simply Rails2" book and thought i could
understand.. but this line is "self.questions.reject{|q| q.nil?}.all" is
complicated.
Please help.
thanks,
radha
Chris Habgood wrote:
> If your models are set up correctly you can do '@user.questions' for
> the collection. You can set up a method or named_scope maybe on the
> user model:
>
> def needed_questions
> self.questions.reject{|q| q.nil?}.all
> end
>
> something like that.
--
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.