Sha256: e792777a67c6d55b448591c1d0c2b4d40048929e5db875863f9fe5828feacaab

Contents?: true

Size: 875 Bytes

Versions: 3

Compression:

Stored size: 875 Bytes

Contents

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

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

class Fauna::User
  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
    timeline :visions
  end

  with Pigkeeper

  with Vision

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

  with Post
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fauna-0.1.2 test/fixtures.rb
fauna-0.1.1 test/fixtures.rb
fauna-0.1 test/fixtures.rb