Sha256: 3019866f38edbad8f79abc1ebb6a0a972365a047a0efe1b38cd8c0f037089614

Contents?: true

Size: 891 Bytes

Versions: 2

Compression:

Stored size: 891 Bytes

Contents

# class Fauna::User
#   field :pockets
# end

# class Fauna::Publisher
#   field :visited
# end

class Fauna::User
  field :name
  field :pockets
end

class Fauna::Publisher
  field :visited
end

class Pig < Fauna::Class
  field :name, :visited
end

class Pigkeeper < Fauna::Class
  field :visited, :pockets

  validates :visited, :presence => true
  validate :pockets_are_full

  def pockets_are_full
    errors.add :pockets, 'must be full of piggy treats' if pockets <= 0 unless pockets.blank?
  end
end

class Vision < Fauna::Class
  field :pronouncement
  reference :pig
end

class MessageBoard < Fauna::Class
end

class Post < Fauna::Class
  field :body
end

Fauna.schema do |f|
  with Pig, :class_name => "classes/pigs" do
    event_set :visions
  end

  with Pigkeeper

  with Vision

  with MessageBoard, :class_name => "classes/board" do
    event_set :posts
  end

  with Post
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fauna-0.2.3 test/fixtures.rb
fauna-0.2.2 test/fixtures.rb