Sha256: 68153f2454c1a6ee7a4a108384ba10cea8aeb53ee0f89721f7b32184bf59121f

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

module ::ResourceBlog
  class User < Ardm::Record
    self.table_name = "users"

    property :name,        String, key: true
    property :age,         Integer
    property :summary,     Text
    property :description, Text
    property :admin,       Boolean, :accessor => :private

    belongs_to :parent, self, :required => false
    has n, :children, self, :inverse => :parent

    belongs_to :referrer, self, :required => false
    has n, :comments

    # FIXME: figure out a different approach than stubbing things out
    def comment=(*)
      # do nothing with comment
    end
  end

  class Author < User; end

  class Comment < Ardm::Record
    self.table_name = "comments"

    property :id,   Serial
    property :body, Text

    belongs_to :user
  end

  class Article < Ardm::Record
    self.table_name = "articles"

    property :id,   Serial
    property :body, Text

    has n, :paragraphs
  end

  class Paragraph < Ardm::Record
    self.table_name = "paragraphs"

    property :id,   Serial
    property :text, String

    belongs_to :article
  end
end

Ardm::Record.finalize

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 spec/fixtures/resource_blog.rb
ardm-0.4.0 spec/fixtures/resource_blog.rb
ardm-0.3.2 spec/fixtures/resource_blog.rb
ardm-0.3.1 spec/fixtures/resource_blog.rb
ardm-0.3.0 spec/fixtures/resource_blog.rb
ardm-0.2.7 spec/fixtures/resource_blog.rb
ardm-0.2.6 spec/fixtures/resource_blog.rb
ardm-0.2.5 spec/fixtures/resource_blog.rb
ardm-0.2.4 spec/fixtures/resource_blog.rb
ardm-0.2.3 spec/fixtures/resource_blog.rb
ardm-0.2.2 spec/fixtures/resource_blog.rb
ardm-0.2.1 spec/fixtures/resource_blog.rb
ardm-0.2.0 spec/fixtures/resource_blog.rb