Skip to content

Commit 8d53dd1

Browse files
committed
Seeding data drops the db, and updated slightly.
Added in emails as well as usernames for blog comments, so I can display gravatars.
1 parent 6e6265d commit 8d53dd1

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

Rakefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ namespace :db do
3333
require 'mongo_mapper'
3434
MongoMapper.connection = Mongo::Connection.new('localhost')
3535
MongoMapper.database = "hackety-#{environment}"
36+
MongoMapper.database.collections.each do |c|
37+
c.remove
38+
end
39+
3640

3741
#make an admin user
3842
require 'models/hacker'
@@ -59,12 +63,22 @@ namespace :db do
5963
:body => "This is an intial post, so that you can see how everything looks. Here's a [link](http://github.com/hacketyhack/hackety-hack.com) to the source code on GitHub. Now I'm just going to do the usual stuff:
6064
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
6165
66+
And a blockquote:
67+
68+
> Lorem ipsum dolor sit amet, consectetur adipiscicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
69+
6270
Esse insolens mnesarchum eam id, nec ad detracto disputando. Nec malorum postulant disputationi ad. Pri menandri inimicus ut. Pro velit affert mediocritatem at, eu nec voluptua inciderint, ne mei diam praesent. No eum tamquam appetere, ex eos habemus evertitur consequat, quo et wisi tincidunt consectetuer. Vocent lobortis est cu."
6371
})
6472

6573
post.comments << Comment.new({
6674
:body => "This post is awesome! I've never seen such insightful commentary!",
67-
:username => "somebody",
75+
:author => "somebody",
76+
:author_email => "somebody@example.com"
77+
})
78+
post.comments << Comment.new({
79+
:body => "Oh, and I almost forgot! I wanted to say something really long, so that we could see how a long comment looks, but I was in such a hurry to compliment your excellent writing that I could barely contain myself! Luckily, this time I'm much more verbose, and so it should fulfill the objective. Great!",
80+
:author => "somebody",
81+
:author_email => "somebody@example.com"
6882
})
6983
post.save
7084

models/comment.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ class Comment
44
# we need to make it embedded, since it's always embedded in a Post
55
include MongoMapper::EmbeddedDocument
66

7-
#we'll save the email of the user that makes the comment, so we can give them credit!
8-
key :user_email, String
7+
#we'll save the user that makes the comment, so we can give them credit!
8+
key :author, String
9+
key :author_email, String
910

1011
key :body, String
1112
end

views/blog_index.haml

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)