Why not support the ability to write properties within models?

After two years of trying I left mongoid to return to activerecord.
The reason why I came back to activerecord is that I realized I had
chosen MongoId just for the chance to express attributes in the model
itself and not for the advantages offered by mongodb.

I suppose this is a fairly common scenario, as well as the reason for
the adoption of other orms as DataMapper: I think that many of those
who choose these ORMs, often do so because they are attracted by the
possibility of writing the model classes in the classical way and not
because they consider truly worst ActiveRecord pattern.

It is not just a matter of style, what you can do with the approach
used by DataMapper or MongoId is something you can just not express
with ActiveRecord, an example over all, how could you do that in
ActiveRecord?

module Profile
  extend ActiveSupport::Concern
  included do
    field :name
    field :age, :as => :integer

  end
end

class User < ActiveRecord::Base
  include Profile

end

class Player < ActiveRecord::Base
  include Profile

end
I wondered how we could achieve the same behavior with ActiveRecord
without altering its nature and in response I created this gem
ActiveRecordSchema (https://github.com/mcasimir/active_record_schema).

I have no interest in promoting my work I just want to propose that a
similar procedure can be adopted directly in Ruby on Rails

I do not know if a similar feature has already been taken into
account, in which case I'm sure you had good reasons for not adopting
it

---
mcasimir

-- 
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