Skip to content

Instantly share code, notes, and snippets.

@mikeraimondi
Created June 9, 2013 15:30
Show Gist options
  • Save mikeraimondi/5743942 to your computer and use it in GitHub Desktop.
Save mikeraimondi/5743942 to your computer and use it in GitHub Desktop.
association validation example
class CrazyCatLady < ActiveRecord::Base
has_many :cats,
inverse_of: :crazy_cat_lady
end
class Cat < ActiveRecord::Base
belongs_to :crazy_cat_lady,
inverse_of: :cats
validates_presence_of :crazy_cat_lady
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment