I imagine this has been brought up before, but I’d really like Rails core to add a library which allows plain old Ruby objects (POROs) to be treated as models, such as ActiveAttr (https://github.com/cgriego/active_attr) or Virtus (https://github.com/solnic/virtus).
ActiveModel comes close to doing this, but there are quite a few gaps such as the ability to define attributes on models, e.g.:
class Person
include ActiveAttr::Attributes
attribute :first_name, default: "Bob"
attribute :last_name, type: String # type-casting
end
The main advantage I see in doing this is that developers no longer need to rely on a third-party library which may diverge from Rails standards. Moreover, there may be opportunity to consolidate functionality common to Mongoid and ActiveRecord in this library.
Thoughts?