Hello, I've been looking for a solution to perform partial validation of a model. This is often an issue when you have multiple forms to fill a single model (ie with wicked wizard gem). They are multiple complicated solutions on the web but it would be fairly easy to implement inside the validation framework.
I can provide a patch if interested. This could be the API: my_object.save(partial_validation: array_of_attributes_to_validate) The modified functions of active_record/validations (on branch 4.2) def valid?(context = nil, partial_validation = nil) context ||= (new_record? ? :create : :update) output = super(context) if partial_validation (errors.keys - partial_validation).each do |attr| errors.delete(attr) end end errors.empty? && output end def perform_validations(options={}) # :nodoc: options[:validate] == false || valid?(options[:context], options[:partial_validation].map(&:to_sym)) end Let me know if interested Regards, Thomas -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.