Sha256: 85be4bd8036d921ee08d66c6fc4a85881d52cfd365b15ddc5c9c78cfe1e43de9

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

Contents

module Frisky
  module Model
    class Repository < ProxyBase
      include MongoMapper::Document

      primary_fetch do |args|
        p = Repository.where(args).first if args.any?
        p or raise NotFound
      end

      key :homepage, String
      key :watchers_count, Integer
      key :html_url, String
      key :owner_id, ObjectId
      key :master_branch, String
      key :forks_count, Integer
      key :git_url, String
      key :full_name, String
      key :name, String
      key :url, String
      key :contributors, Object

      timestamps!

      belongs_to :owner, class_name: 'Frisky::Model::Person'

      def save(*args)
        if self.no_proxy_contributors
          cvalues = {}
          self.no_proxy_contributors.each do |c, value|
            cvalues[c.to_s] = value
          end
          self.contributors = cvalues
        end
        super(*args)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frisky_mongo-0.7.7 lib/frisky-mongo/models/repository.rb