Skip to content

Commit

Permalink
add data generator for creating followships
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostandthemachine committed Nov 24, 2012
1 parent cbcb10e commit 8faa0f8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/model/base.rb
Expand Up @@ -173,6 +173,8 @@ def get_month(creation_date)
print "."
dg.rand_users
print "."
dg.rand_followships
print "."
dg.rand_events 100
print "."
dg.rand_comments
Expand Down
11 changes: 11 additions & 0 deletions lib/model/data_generator.rb
Expand Up @@ -394,5 +394,16 @@ def rand_messages(max_msg_per_user=10)
puts "."
end

def rand_followships(max_followers_per_user=5)
puts "Generate random followships between users."
User.all.each do |u|
print "."
(0..max_followers_per_user).each do |i|
u.follow(User[i])
end
end
puts "."
end

end

1 change: 1 addition & 0 deletions lib/views/event/event.haml
Expand Up @@ -54,6 +54,7 @@
}).done(function( msg ) {
if (msg == "true") {
$('.follow-btn').remove()
$('#follow-tray').prepend("<div class='alert alert-success unfollow-success-msg'>Successfully following " + followed_username + "</div>")
$('#follow-tray').append("<p class='btn btn-primary following-btn'>Following #{event.user.user_name}</p>")
} else {
console.log("failed to follow user")
Expand Down

0 comments on commit 8faa0f8

Please sign in to comment.