virtus icon indicating copy to clipboard operation
virtus copied to clipboard

Added method attribute_names

Open fr33z3 opened this issue 11 years ago • 3 comments

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 avatar Jan 06 '15 11:01 fr33z3

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

fr33z3 avatar Feb 02 '15 11:02 fr33z3

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.

solnic avatar Feb 02 '15 11:02 solnic

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.

booch avatar Nov 12 '15 21:11 booch