On 10.5.2005, at 01:39, Jason Foreman wrote:
> On 5/9/05, Pedro Valentini
<pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org> wrote:
>>
>> Hi all,
>>
>> I want to create a field in database, published, and show only the
>> this
>> item if this is published(1).
>> What is the better way to do this?
>>
>> Thank you
>>
>> --
>>
>> Pedro C. Valentini
>> pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org
>> +55 (21) 8708-8035
>>
>> _______________________________________________
>> Rails mailing list
>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>
> Use a condition when looking up the objects:
>
> Item.find(:all, :conditions => "published = 1")
Or use AR magic finders:
Item.find_all_by_published(1)
//jarkko
>
> Take a look at the ActiveRecord documentation [1] for other options to
> use.
>
>
> Jason
>
> [1] http://ar.rubyonrails.com
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Jarkko Laine
http://jlaine.net
http://odesign.fi
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails