Em 09-05-2012 10:52, Maurizio Casimirri escreveu:
Back to the subject:

I've tried to convince you not to argue about defining the properties inside the models to avoid duplication of code in migrations because they should be really isolated from each other from my point of view

... From your response I guess you have missed the conversation from the begining am i right?

I've just re-read all conversation to make sure, but I couldn't find out why you guessed so.

My concern was that implementing properties in models ActiveRecord could have the same benefits that some other ORMs are taking advantage yet.

I don't see any issues with the way AR Migrations were designed when used separately from the application itself.

I really don't like the idea of automatically generating migrations from information extracted from the model class. Grails always supported that kind of database evolution, inherited from Hibernate and I always found it a bad approach.

For example, what if you remove an attribute declaration from your model? Maybe you're not using it anymore in your specific application, but you don't want it to generate a migration that will remove that field from the table.

Also, how can you detect field renaming, for example? This is too much to automate in my opinion. I prefer to be explicit in generating my migrations than to try to automatically generate one based on current database schema and annotated model class.

When you have multiple applications using the same database it is likely that not all applications will need all fields from the database, so it makes sense to document just those who are relevant to your specific application.

Also, when you want to create a program to interact with a legacy database, it is great that you're able to use it without having to declare all fields in the model and just rely on database introspection made by ActiveRecord or Sequel on class generation.

So, for my use case I can't really see any advantages in enforcing annotations in ORM models. And to be honest, I have a hard time trying to figure out in what use case such annotated classes could be useful...

You can already use database introspection within mixins as well as setting up inheritance. Maybe it would help if you could provide some concrete examples on what you think it is currently impossible to do with ActiveRecord and how that would become possible with your approach.

Best,
Rodrigo.

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to