Rails - Validate on Create Only

ruby-on-rails

Solution

Try this on your line of validation code:

validate :custom_validation, on: :create

this specifies to only run the validation on the `create` action.

Source:

ActiveModel/Validations/ClassMethods/validate @ apidock.com

Problem

I'm trying to get my custom validation to work on `create`. But when I do a `find` then `save`, rails treats it as `create` and runs the custom validation. How do I get the validations to only work when creating a new record on not on the update of a found record?

Original source