hotsh/rstat.us — comment on commit 0486e6c5a42bf63304473f4749a57746fcbb0ccb
File: app/models/update.rb line 270
By caleywoods:

My original intention was to improve the readability of ```do_not_repeat_yourself``` by moving your check (verbatim) into ```already_posted?```. As i said before, I didn't notice I'd left off the final check for author.id.

Unless anyone is against it I'd like to change this to:

```ruby
def do_not_repeat_yourself
errors.add(:text, "You already posted this update.") if already_posted?
end

# The logic here is that this update came from the same person, says the same thing as the last post, but isn't the last post.
# feed.last_update exists to prevent this check from failing where last_update is nil
def already_posted?
feed.last_update && feed.last_update.id != id && feed.last_update.text == text && feed.last_update.author.id == author.id
end
```

This was my original intention anyway, I only accidentally excluded ``&& feed.last_update.author.id == author.id```.