On Wed, Jan 14, 2009 at 3:24 AM, Rails Terrorist <
rails-mailing-l...@andreas-s.net> wrote:
>
> James Bond wrote:
> > I use will_paginate to get results:
> >
> > @results = Users.paginate(:all, :conditions => "...
> >
> > But how can I get a number of reults?
>
> to get a number of result you can
James Bond wrote:
> I use will_paginate to get results:
>
> @results = Users.paginate(:all, :conditions => "...
>
> But how can I get a number of reults?
to get a number of result you can get it by :
@results.size
if @results.size < 1
flash[:notice] = "There's no result so its data is empty."
;
>> x = @results.empty? ? 1 : 0
>>
>> -Original Message-
>> From: rubyonrails-talk@googlegroups.com
>> [mailto:rubyonrails-talk@googlegroups.com
>> ] On Behalf Of James Bond
>> Sent: Tuesday, January 13, 2009 11:42 AM
>> To: rubyonrails-talk@goo
t; x = @results.empty? ? 1 : 0
>
> -Original Message-
> From: rubyonrails-talk@googlegroups.com
> [mailto:rubyonrails-t...@googlegroups.com] On Behalf Of James Bond
> Sent: Tuesday, January 13, 2009 11:42 AM
> To: rubyonrails-talk@googlegroups.com
> Subject: [Rails]
x = @results.empty? ? 1 : 0
-Original Message-
From: rubyonrails-talk@googlegroups.com
[mailto:rubyonrails-t...@googlegroups.com] On Behalf Of James Bond
Sent: Tuesday, January 13, 2009 11:42 AM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: Number of entries
How can I
How can I write it simple?
if @results.empty?
x = 0
else
x = 1
end
--
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
6 matches
Mail list logo