Rails validation required parameter (lock_version)

This type of validation is handled by validates_presence_of.

Seems like you’re looking for

validates_presence_of :lock_version, on: :update

I strongly advise to take a look on http://apidock.com/rails/ActiveRecord/Validations/ClassMethods/validates_presence_of

There are plenty of validations in Rails and this is probably the most basic one.

http://guides.rubyonrails.org/active_record_validations.html

Leave a Comment