Created
January 13, 2013 00:36
-
-
Save k2052/4521332 to your computer and use it in GitHub Desktop.
Eva Zebra In Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Eva < Zebra | |
include MongoMapper::Document | |
include Vegan::Powers | |
include MongoMapperExt::Taggable | |
include MongoMapper::Tweetable | |
## Keys | |
key :scarves_count, Integer, :default => 20 | |
key :compliments_count, Integer, :default => 100 | |
## Associations | |
has_many :scarves | |
has_many :followers | |
has_many :friends | |
has_one :macbook | |
has_one :iphone | |
belongs_to :earth | |
## Validations | |
validates_acceptence_of :all_humans, :self_aware_robots | |
validates_inclusion_of :nick, :in => :friend_names | |
validate :scarf_count | |
validates_presence_of :boobs | |
validates :drunkness, :if => { ['friday', 'saturday', 'sunday'].include?(Time.today) } | |
def scarf_count | |
self.errors.add(:scarves, "Need more scarves") unless self.scarves.count > 10 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment