shields-SDsbS6MNdXR3+QwDJ9on6Q@public.gmane.org
2014-Jul-19 06:27 UTC
Add model support for POROs to Rails core? (like ActiveAttr or Virtus)
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? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c8d644d4-d5cf-4b84-b3eb-db7e86df5811%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.