Skip to content

Instantly share code, notes, and snippets.

@schovi
Created December 8, 2010 23:34
Show Gist options
  • Save schovi/734113 to your computer and use it in GitHub Desktop.
Save schovi/734113 to your computer and use it in GitHub Desktop.
idea of chaining error validations
class UltraModel < ActiveRecord::Base
validates_presence_of :super_id
validates_format_of :super_id, :dependency => :super_id_presence
validates_uniqueness_of :super_id, :dependency => :super_id_format
validates :super_object_exist, :dependency => :super_id_uniqueness
private
def super_object_exist
...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment