From: Leslie Viljoen Date: 2006-11-24T00:27:03+09:00 Subject: Re: Active Record out of rails: still assumes id? On 11/22/06, Ezra Zygmuntowicz wrote: > > On Nov 21, 2006, at 11:41 AM, Damphyr wrote: > > > Chris Gallagher wrote: > >> unknown wrote: > >> I solved this by just throwing in the id field. Wasnt really a big > >> thing to do. > > I'm actually using active record in a similar fashion. I just want > > the ORM (with the thinking that at some point in the very near > > future I can use Rails to give me a nice frontend for my data). > > > > The one thing I miss is the whole Rails infrastructure for putting > > the db schema in YAML and automating the migrations, but I would > > still recommend using migrations, even if you have to code them. > > That way all the nice :has_many etc. works without thinking. > > That said, I still structured the app using the Rails conventions > > so that when I use Rails I can dump my coded migrations and > > leverage the scripts. > > Btw. Agile Web Development with Rails, 2nd ed (the beta book) is an > > enormous help for figuring things out, even if you just want to use > > active record :). > > And no, I have no affiliation whatsoever with Andy or Dave :) > > Cheers, > > V.- > > > I was able to get ActiveRecord migrations working outside of rails > by tweaking the rake tasks and a little scripting. My little web > framework called Merb uses AR but does migrations in a similar way to > rails. Here are the relevant files to look at if you want to do > something similar: > > http://svn.devjavu.com/merb/lib/tasks/db.rake > > http://svn.devjavu.com/merb/examples/sample_app/script/new_migration Great stuff!