How do I validate certain fields with rails devise on registration only
问题 I have a set of custom fields attached to a devise model called Entrant. I have two forms, one for registration form (three fields) and one which sits in the account area (12 fields). Most of the custom fields area required but only within the form the sits in the account area. How do I achieve this? I am using rails 4.2 and ruby 2.1 回答1: You can simply specify validations on actions, that is: validates :name, presence: true, on: :create # which won't validate presence of name on update