solnic / virtus

[DISCONTINUED ] Attributes on Steroids for Plain Old Ruby Objects
MIT License
3.77k stars 228 forks source link

Added method attribute_names #305

Open fr33z3 opened 9 years ago

fr33z3 commented 9 years ago

Added little but useful method attribute_names for Virtus model. There are a lot of cases when we need to get attribute names in a simple way.

fr33z3 commented 9 years ago

27 days and no any comments and not merged, what's going on?

solnic commented 9 years ago

Sorry, I have very little time for Virtus these days.

Regarding this addition - I would accept it if it was a method defined on attribute_set itself. ie AttributeSet#names so that you could do YourClass.attribute_set.names.

We want to add as little as possible to the interface of the class or module that includes a virtus extension.

booch commented 8 years ago

My first thought was that attribute_names would be useful, and doesn't pollute the model's namespace any worse than attributes. But since attributes is deprecated, I think @solnic is right --- we should implement it as attribute_set.names instead.

I find ActiveRecord's attribute_names useful, but it doesn't seem to be required to use ActiveModel.