Sha256: 6097a20a52efcf81c68f246ce69c7a6275f58e927f2932e2310324c148a5767b

Contents?: true

Size: 853 Bytes

Versions: 9

Compression:

Stored size: 853 Bytes

Contents

require 'digest/sha1'
require "uri"

require "model/domain_model.rb"
require "models/blurb.rb"

class Friend < DomainModel
  property :id,:string,:is_primary_key=>true
   property :user_name,:string
   property :friend_user_name,:string
   property :created_time_utc,:date
 belongs_to :User,:user_name,:user
 belongs_to :User,:friend_user_name,:friend
 index :user_name_and_friend_name,[:user_name,:friend_user_name],:unique=>true
  def Friend.make_friend(user_name,friend_name)
    existing_friend=Friend.find_by_user_name_and_friend_name(user_name.capitalize ,friend_name.capitalize)
    if existing_friend==nil
     newFriend=Friend.new
        newFriend.user_name=user_name
        newFriend.friend_user_name=friend_name
        newFriend.created_time_utc=Time.now.gmtime
        newFriend.save
      return true
    end
      return false
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cloudwow-not_relational-0.1.0 test/models/friend.rb
cloudwow-not_relational-0.1.11 test/models/friend.rb
cloudwow-not_relational-0.1.2 test/models/friend.rb
cloudwow-not_relational-0.1.3 test/models/friend.rb
cloudwow-not_relational-0.1.5 test/models/friend.rb
cloudwow-not_relational-0.1.6 test/models/friend.rb
cloudwow-not_relational-0.1.7 test/models/friend.rb
cloudwow-not_relational-0.1.8 test/models/friend.rb
cloudwow-not_relational-0.1.9 test/models/friend.rb