Is this what you mean?
myhash = Hash.new
Model.find(:all).collect{|m| myhash[m.value1]=m.value2}
On 1/23/06, Kyle Mathews <kyle@titaniumdev.com>
wrote:>
> This may be more of a Ruby question, but I wasn''t sure.
>
> Is there a way to run a find on a model and then save two fields as
> key => value in an array for each row. Then use this array on the
> template for checking if various checkbox or select values are
> checked? I''m trying to avoid running one query to check the value
for
> each box in the form.
>
> - Kyle
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060124/baf44f27/attachment-0001.html