From: Brian Candler Date: 2010-06-10T17:56:27+09:00 Subject: Re: Looking for ORM for 'legacy' database. Dave Howell wrote: > On Jun 8, 2010, at 7:11 , Brian Candler wrote: >> Aside: Rails (or ActiveRecord) expects that the primary key is called >> "id". > > Yea, but I'd already rejected that convention. > > create table Horses ( > horse_id primary-key-thing, > ranch_id foreign-key-thing > ... > ); OK. You said you'd gotten tired of including the underscores, so I wasn't clear want convention you were using instead. > Oh, I never doubted it that it could be done. My problem was that the > overwhelming percentage of available documentation assumes that I > *won't* be doing it that way, so that I couldn't find the information I > needed to make it work. The AR documentation is pretty comprehensive. All I needed was to find self.table_name = ... self.primary_key = ... and to look at the options provided by belongs_to/has_many. Note that the AR documentation is available separately from the Rails documentation here: http://ar.rubyonrails.org/ But anyway, if you've found something else you prefer, that's great. If nothing else, it will likely to be much more lightweight than AR in terms of startup time and memory usage. > Um, but I hadn't planned on using Rails at all. Sorry, I misinterpreted "in anticipation of using Rails with it one day" as meaning that Rails was on your roadmap. > I haven't gotten to actually using Haml yet, but it took me about 30 > seconds to fall in love with it. Barring catastrophic incompatibilities > with Sequel &/or Ramaze (which seems highly improbable), I'm done > evaluating, and have finally moved on to developing. If you love it at first glance, you'll love it completely. I've done projects with Sinatra+HAML as well as Rails+HAML. Hopefully I'll never see another ERB template :-) Regards, Brian. -- Posted via http://www.ruby-forum.com/.