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

Use ActiveRecord#persisted? instead of ActiveRecord#new_record? #600

Merged
merged 2 commits into from
Apr 9, 2014

Conversation

tubaxenor
Copy link

When record was destroyed, it will return false when new_record? called :

u = User.first
>> u.new_record?
=> false
>> u.persisted?
=> true

>> u.destroy

>> u.new_record?
=> false
>> u.persisted?
=> false

I think persisted? is more appropriate here.

When record was destroyed, it will return false when new_record? called :
```
u = User.first
>> u.new_record?
=> false
>> u.persisted?
=> true

>> u.destroy

>> u.new_record?
=> false
>> u.persisted?
=> false
```
I think persisted? is more appropriate here.
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.06%) when pulling 1f179dc on tubaxenor:patch-1 into 2f02f64 on collectiveidea:master.

@albus522
Copy link
Member

This appears to break every test build.

@coveralls
Copy link

Coverage Status

Coverage increased (+8.57%) to 100.0% when pulling f208532 on tubaxenor:patch-1 into 2f02f64 on collectiveidea:master.

albus522 added a commit that referenced this pull request Apr 9, 2014
Use ActiveRecord#persisted? instead of ActiveRecord#new_record?
@albus522 albus522 merged commit 06a4598 into collectiveidea:master Apr 9, 2014
@tubaxenor tubaxenor deleted the patch-1 branch April 9, 2014 22:33
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