On Thu, 20 Jan 2005 11:37:27 -0800, Berndt Jung
<berndtj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> I have a hash stored in a record. I would like to access it in a similar
manor
>
> @students =
Student.find_all["weekdays[''?''][''?],
@params[''detail''],
> @params[''id]]
Short answer, you can''t.
There may be some hacks you can implement to search the content of
those fields with like etc.. However it''s probably not worth the
effort, if you want to restrict your queries based on some attribute,
make that attribute a column.
> The only way I can manage is by first finding all the students, then
> parsing through and looking at each indivitual weedays hash
>
> students = Student.find_all
> @students = Array.new
> students.each { |s|
> begin
> @students << s if
s.weekdays[@params[''detail'']][@params[''id''].to_s]
> rescue NoMethodError
> end
> }
>
> is there a more efficient way?
>
> Thanks
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Cheers
Koz