Thanks Anthony, Did a little more homework and decided to use:
unless @client.line_items.blank? as .blank? will not bomb on a nil condition and .empty? will. But thanks very much for pointing me in the right direction. Regards, Paul Thompson On 13 April 2010 14:16, Anthony Crumley <[email protected]> wrote: > Paul, > > Sorry, but I gave you the wrong method. It should have been ... > > unless @client.line_items.empty? > > Anthony Crumley > http://commonthread.com > > On Mon, Apr 12, 2010 at 9:10 PM, Paul Jonathan Thompson <[email protected]> > wrote: >> >> Thanks Anthony, >> >> It's better, but I'm not quite there yet. I am now getting: >> >> wrong number of arguments (0 for 1) >> >> Regards, >> >> Paul Thompson >> >> On 13 April 2010 13:56, Anthony Crumley <[email protected]> wrote: >> > Paul, >> > >> > if @client.line_items.exists? >> > >> > Anthony Crumley >> >> > On Mon, Apr 12, 2010 at 8:30 PM, Paul Jonathan Thompson >> > <[email protected]> >> > wrote: >> >> >> >> What is the new way to check if a parent has child items? In rails >> >> 1.2.6 I did this: >> >> >> >> if @client.has_line_items? >> >> >> >> Client being the parent and line_items the children. >> >> >> >> Now that I have upgraded to rails 2.0.1 (on my way to current :-) ) I >> >> am getting this message: >> >> >> >> undefined method `has_line_items?' for #<Client:0x7f3b093b01a0> >> >> >> >> How should I format the query now? >> >> -- >> 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. >> > > -- > 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. > -- 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.

