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

Resolve warnings by checking if @attributes is defined #2363

Closed
wants to merge 1 commit into from
Closed

Resolve warnings by checking if @attributes is defined #2363

wants to merge 1 commit into from

Conversation

bcardarella
Copy link
Contributor

When @attributes is undefined (in the case of some of the tests using .allocate instead of .new on an AR class) a warning will be thrown.

As this adds an extra conditional it could be a performance hit but I suspect the only time anybody is really calling #inspect on an AR object is from within the console so it shouldn't be a big deal.

@josevalim
Copy link
Contributor

If someone is calling allocate, they should call initialize themselves. It is not worth adding this check because of thi allocate special case. I would fix this instead by calling model.instance_variable_set in the test itself.

@josevalim josevalim closed this Jul 30, 2011
@bcardarella
Copy link
Contributor Author

Ok, I'll update the working branch and resubmit

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.

None yet

2 participants