Sha256: dfd3e2eaadf811d0f9f8e7f6b5b06ae71aa98f0c213f36202216eac1121a39fe

Contents?: true

Size: 1016 Bytes

Versions: 16

Compression:

Stored size: 1016 Bytes

Contents

require 'data/image'
require 'data/commentable'
require 'data/viewable'
require 'data/taggable'
require 'data/user'
require 'data/bot'
require 'data/tag'

class Article
  include DataMapper::Resource

  property :id, Serial
  property :title, String
  property :url, String


  remix 1, :images, :as => "pics"

  remix n, :viewables, :as => "views"

  remix n, :commentables, :as => "comments", :for => "User"

  remix n, "My::Nested::Remixable::Rating", :as => :ratings

  remix n, :taggable, :as => "user_taggings", :for => "User", :model => "UserTagging"

  remix n, :taggable, :as => "bot_taggings", :for => "Bot", :model => "BotTagging"

  enhance :viewables do
    belongs_to :user
  end

  enhance :taggable, "UserTagging" do
    belongs_to :user
    belongs_to :tag
  end

  enhance :taggable, "BotTagging" do
    belongs_to :bot
    belongs_to :tag
  end

  def viewed_by(usr)
    art_view = ArticleView.new
    art_view.ip = "127.0.0.1"
    art_view.user_id = usr.id

    self.views << art_view
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dm-is-remixable-1.2.0 spec/data/article.rb
dm-is-remixable-1.2.0.rc2 spec/data/article.rb
dm-is-remixable-1.2.0.rc1 spec/data/article.rb
dm-is-remixable-1.1.0 spec/data/article.rb
dm-is-remixable-1.1.0.rc3 spec/data/article.rb
dm-is-remixable-1.1.0.rc2 spec/data/article.rb
dm-is-remixable-1.1.0.rc1 spec/data/article.rb
dm-is-remixable-1.0.2 spec/data/article.rb
dm-is-remixable-1.0.1 spec/data/article.rb
dm-is-remixable-1.0.0 spec/data/article.rb
dm-is-remixable-1.0.0.rc3 spec/data/article.rb
dm-is-remixable-1.0.0.rc2 spec/data/article.rb
dm-is-remixable-1.0.0.rc1 spec/data/article.rb
dm-is-remixable-0.10.2 spec/data/article.rb
dm-is-remixable-0.10.1 spec/data/article.rb
dm-is-remixable-0.10.0 spec/data/article.rb