Regarding the 'if', I thought if Blog.find_all_by_project_id(params [:id]) returned 0 records, then @blogs is nil.
...anyway I am just trying to find how many records are in @blogs, I thought @blogs.size would give me that. Jet On Dec 14, 2:10 pm, Matt Jones <[email protected]> wrote: > On Dec 14, 2009, at 5:00 PM, blueHandTalking wrote: > > > > > > > Anyway, in my BlogsController I have the following: > > > @blogs = Blog.find_all_by_project_id(params[:id]) > > > checking for existence and size, > > > if (@blogs) > > flash[:notice] = "#[email protected]}" > > if (@blogs.size == 5) > > > I enter the first if conditional statement, so @blogs is not nil. > > > This generates '0' in my flash message, and I never enter > > my second if statement. I thought I looked into this pretty good, > > but nowhere have I found that what I am trying is incorrect. > > Not sure what you mean - are you intending the if statement on the > size to apply to the statement above? > > Also note that find_all_* and friends will *always* return an Array > (or should - if you're getting nil out of a find_all, file a Rails > bug!), so checking @blogs seems a little paranoid. > > --Matt Jones -- You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en.
