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

[ci skip] Check a result of valid? instead of create #19438

Merged
merged 1 commit into from
Mar 21, 2015

Conversation

yui-knk
Copy link
Contributor

@yui-knk yui-knk commented Mar 21, 2015

Person.create returns person object even if person is invalid.
So check a result of valid?.

@egilburg
Copy link
Contributor

valid? doesn't actually try to save, though.

The correct example would be if @person.save

@yui-knk
Copy link
Contributor Author

yui-knk commented Mar 21, 2015

I think Person.create(params[:person]) tries save (here). Isn't it?

@egilburg
Copy link
Contributor

Ah, you're right. Usually I'm always writing .build instead, though.

@yui-knk
Copy link
Contributor Author

yui-knk commented Mar 21, 2015

Thanks for your reviews, but this comment is about .create, so this example uses .create.

That hash is ready to be passed to Person.create

arthurnn pushed a commit that referenced this pull request Mar 21, 2015
[ci skip] Check a result of `valid?` instead of `create`
@arthurnn arthurnn merged commit 92a3c8d into rails:master Mar 21, 2015
@arthurnn
Copy link
Member

thanks

@yui-knk yui-knk deleted the fix/comment branch March 21, 2015 04:12
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

3 participants