Skip to content

Commit 2ad1e09

Browse files
committed
let's store objectids rather than emails
1 parent 4aee440 commit 2ad1e09

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

controllers/hacker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
@hacker = Hacker.first(:username => params[:name])
2020

2121
#follow them!
22-
Hacker.push_uniq(current_user.id, :following => @hacker.email)
23-
Hacker.push_uniq(@hacker.id, :followers => current_user.email)
22+
Hacker.push_uniq(current_user.id, :following => @hacker.id)
23+
Hacker.push_uniq(@hacker.id, :followers => current_user.id)
2424

2525
#set a message
2626
flash[:notice] = "Now following #{params[:name]}."

models/hacker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class Hacker
1717
key :admin, Boolean, :default => false
1818

1919
#the list of emails this user is following
20-
key :following, Array
20+
key :following, Array, :typecast => 'ObjectId'
2121

2222
#the list of emails of users that are following this user
23-
key :followers, Array
23+
key :followers, Array, :typecast => 'ObjectId'
2424

2525
#we don't want to store the password (or the confirmation), so we just make an accessor
2626
attr_accessor :password, :password_confirmation

0 commit comments

Comments
 (0)