Class: SocialSnippet::RegistryCore::Models::UserAccount

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/social_snippet/registry_core/models/user_account.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_by_id(s) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/social_snippet/registry_core/models/user_account.rb', line 24

def self.find_by_id(s)
  if s.nil?
    nil
  else
    begin
      find s
    rescue
      nil
    end
  end
end

Instance Method Details

#github_repos_namesObject

You can create a composite key in mongoid to replace the default id using the key macro: key :field <, :another_field, :one_more .…>



18
19
20
21
22
# File 'lib/social_snippet/registry_core/models/user_account.rb', line 18

def github_repos_names
  github_repos.map do |repo_name|
    { :name => repo_name, }
  end
end