Semantic Meaning in ActiveRecord Attributes


My problem:

Attributes in ActiveRecord have no semantic meaning. And the attributes are defined in the db making it difficult to attach semantic meaning in the db level (without making things complicated in the schema)

I want to associate very simple semantic/metadata information to attributes of models, without having to put all the fields in the db into the Model file. As this feels like its breaking the DRY principle (and making Rails models less clean and agile).

I've looked at Django and how it deals with meta data and models and I'm wishing I could do something similar in Rails. See my descriptions here ( semantics-with-rails-and-django.html) Ultimately its models are defined in Python objects and mapped down to db types, so metadata is easy to attach.

I want to try and achieve something like:

Database -> Polls{Id Integer(11), monkeyZipcode Char(12)}

And in the Polls Model metadata in the model indicating that 'monkeyZipcode' is a zipcode rather than just a char(12).

I've thought about: *Representing meta data in the database about the database :slight_smile: *Inferring semantic meaning from the name of model attributes fields

There does look like some promising projects currently going in in Rails:

Have other people tried to deal with this problem?

Any thoughts highly appreciated.

Thanks, Joseph Wilk