Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method attribute_names #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added method attribute_names #305

wants to merge 1 commit into from

Conversation

fr33z3
Copy link

@fr33z3 fr33z3 commented Jan 6, 2015

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
Copy link
Author

fr33z3 commented Feb 2, 2015

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

@solnic
Copy link
Owner

solnic commented Feb 2, 2015

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
Copy link
Collaborator

booch commented Nov 12, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants