-
-
Save vilhalmer/4521461 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
key :hivemind_response_count, Integer, :default => 500 | |
## Associations | |
has_many :scarves | |
has_many :tweets, :followers, :mentions | |
has_many :friends, :creeps | |
has_many :tattoo | |
has_one :macbook | |
has_one :iphone | |
has_one :boyfriend | |
has_one :bffle | |
belongs_to :earth | |
## Validations | |
validates_acceptence_of :all_humans, :self_aware_robots, :bowties | |
validate :bffle | |
validates_inclusion_of :tim, :in => :lover_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 | |
def hivemind_response_count | |
self.errors.add(:tweet, "NEED MORE HIVEMIND RESPONSES") unless self.mentions.count > 100 | |
end | |
def bffle | |
self.errors.add(:bffle, "What have you done with the real Nick?!") unless self.bffle == "Nick Quinlan" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment