Chris,
I would consider forming two many-to-many relationships.
Data tables: keywords, books
Join tables: book_keywords, keywords_keywords (or something like
parent_keywords_keywords)
Then each keyword could be associated with other keywords and with
books. See what I''m saying? This kind of setup would allow you the
flexibility to have sub-categories for every category, but not require a
book (or ''resource'' or whatever) to necessarily belong to a
bottom level
category. Your searching should then end up pretty easy, going
something like "find books with keyword1 [and keywordN]*"
Is this totally obfuscating your question? I have a headache and am not
explaining myself totally clearly. If you''d like a better explaination
of this theory please let me know.
-Jeff
Steve Downey wrote:
> Chris Lambert wrote:
>
>> I''m writing a web based book loaning system. I allow people to
drill
>> down through the list of books via associated tags. For example, you
>> can look at a list of books tagged with "perl". And from
there, you
>> can select additional filters such as "web",
"sysadm", or "sql". I''m
>> wondering how to:
>>
>> a) constuct links to these drill down filters, preferably with an
>> infinite depth
>> b) read in the list of applied filters from the given params
>>
>> So, something like:
>> a) link_to(tag.name, :action => tag, :filter => [*@tags,
tag.name])
>> b) @tags = []; @tags = params[filter]
>>
>> What''s the Rail''s "best practice" for this
sort of thing?
>>
>>
>>
>
> Not particulary elegant, but what about passing a single param with
> the various tags delimited like "tag1:tag2"?
>
> Assuming you know current filters in place the link to add a new
> filter would be:
>
> :action => tag, :filter =>
@current_tags.push(''newtag'').join('':'')
>
> then in the controller @current_tags =
parmas(:filter).split('':'')
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails