Sign in through GitHub

RailsCasts Pro episodes are now free!

Learn more or hide this

rockusbacchus's Profile

GitHub User: rockusbacchus

Comments by

Avatar

This was yet another awesome tutorial. I have chosen to go with your custom locking mechanism in my current project. Although I had to figure out my way through using an added time based field in the database as you mentioned at the end of the video, I did make one change to your handle_conflict method, changing the line that reads:

ruby
errors.add name, "was #{values.first}"

to:

ruby
errors.add attribute, "was " + (values.first.blank? ? "blank" : values.first.to_s)

To handle cases where something was added to a blank field during edit.