From: Marnen Laibow-Koser Date: 2009-12-30T06:17:55+09:00 Subject: Re: create links using erb and mysql Ad Ad wrote: > Hi, > I have a database directory. > > On my home page, > I have these links for (which I handle manually for now): > A B C D E......(upto ) Z > > Each link is hyperlinked only if there is a name starting with that > letter. If there is no name starting with that letter then that letter > will be not be hyperlinked. > [...] > Is there a way to dynamically assign the hyperlinks through a db > query? The interface you just described seems like a bit of a disaster, and there are probably nicer ways to do it. But... It should be possible to see if you can retrieve one record from the DB in the relevant alphabetic range. If so, then make a link. If not, don't. It's that simple. > > I know how to create the html using erb. You might want to look at Haml, which gives you prettier syntax and CSS abstraction. > > -ad Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.