Add method AttributeSet#names to return array of all attribute names#379
Add method AttributeSet#names to return array of all attribute names#379tracyloisel wants to merge 4 commits intosolnic:masterfrom
Conversation
|
I think it's bloat as User.attribute_set.map(&:name) # => [:name, :age] |
|
I think a lot of people may find this feature useful so it should be part of the gem. In our case, we use Virtus in a ruby (ruby only) project. In some factory classes we want to permit the params with the strict list of attributes as described in our virtus classes. The 30 minutes we took to read the source code and write the method could benefit to all the community around Virtus.
|
|
Params whitelisting is your specific use case. If you find that you repeat Otherwise, what stops you from adding more methods at the That's why IMO, you're bloating a generic library for your specific needs. |
Returns all the attributes name defined on a Class