From: Jason Roelofs Date: 2007-05-18T03:55:51+09:00 Subject: Re: Some Ruby Features missing... ------=_Part_40875_12026330.1179428150790 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Well I'll just come out and say it: Please oh please do not try to do Java persistence in Ruby. Learn how to do things the Ruby way. For your specific example here, when using ActiveRecord, if there's a database table with a field of "id", that field is automatically recognized as the primary key. If the primary key isn't "id", then it's very simple to tell AR what the field is called: class MyModel < ActiveRecord::Base set_primary_key "model_id" end With Ruby and ActiveRecord, the philosophy is for one to design the database and let Ruby figure out class attributes from the database. This is the opposite of Java persistence (Hibernate), so you need to keep this in mind. (personally, Hibernate drives me absolutely bonkers because of this). So if you have specific questions about what to do in Ruby, or how to do something, we'll be happy to answer it. You'll find that a lot of things you have to do in Java are simply non-issues in Ruby. Jason On 5/17/07, edlich@gmail.com wrote: > > On 16 Mai, 21:10, "Lyle Johnson" wrote: > > On 5/16/07, edl...@gmail.com wrote: > > > > > 1. Does Ruby support Annotations? Or is there another cool way to do > > > this > > > without changing the class itself? > > > -> I need to tell reflection to do something special with the class. > > > > We might be able to better address this question if you could say what > > it is that you're trying to accomplish. > > Well, I am sure you know 1000 areas for Annotations (as UML > Stereotypes, like > let the User decide what any program should do with your class or your > instances > without affecting the original class.) > One good example is to mark a class with "@index" to create an index > if this > class is stored in a database. > > Any idea how to perform this? > > Thanks! > Stefan E. > > > ------=_Part_40875_12026330.1179428150790--