Sha256: 1199ae68b1836810573f4734fe1f915e8da104436245c80583f4158945792b32
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 Bytes
Contents
module Frisky module Model class Person < ProxyBase include MongoMapper::Document fetch_key :id primary_fetch do |args| p = Person.where(_id: args[:id]).first if args[:id] p ||= Person.where(login: args[:login]).first if args[:login] p ||= Person.where(email: args[:email]).first if args[:email] p or raise NotFound end key :name, String key :login, String key :email, String key :bio, String key :location, String key :blog, String key :company, String key :followers, Integer key :gravatar_id, String key :avatar_url, String key :html_url, String def self.load_from_raw(raw) model = super(raw) model.save if model.new? model 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/person.rb |